Macro ffi_support::define_bytebuffer_destructor[][src]

macro_rules! define_bytebuffer_destructor {
    ($destructor_name:ident) => { ... };
}

Define a (public) destructor for the ByteBuffer type.

Caveats

If you’re using multiple separately compiled rust libraries in your application, it’s critical that you are careful to only ever free ByteBuffer instances allocated by a Rust library using the same rust library. Passing them to a different Rust library’s string destructor will cause you to corrupt multiple heaps. One common ByteBuffer destructor is defined per Rust library.

Also, to avoid name collisions, it is strongly recommended that you provide an name for this function unique to your library. (This is true for all functions you expose).

Example

define_bytebuffer_destructor!(mylib_destroy_bytebuffer);