[][src]Macro ffi_support::define_handle_map_deleter

macro_rules! define_handle_map_deleter {
    ($HANDLE_MAP_NAME:ident, $destructor_name:ident) => { ... };
}

Define a (public) destructor for a type that lives inside a lazy_static [ConcurrentHandleMap].

Note that this is actually totally safe, unlike the other define_blah_destructor macros.

A critical difference, however, is that this dtor takes an err out parameter to indicate failure. This difference is why the name is different as well (deleter vs destructor).

Example

struct Thing(Vec<i32>);
// Somewhere...
lazy_static! {
    static ref THING_HANDLES: ConcurrentHandleMap<Thing> = ConcurrentHandleMap::new();
}
define_handle_map_deleter!(THING_HANDLES, mylib_destroy_thing);