Skip to main content

FreeStringFn

Type Alias FreeStringFn 

Source
pub type FreeStringFn = unsafe extern "C" fn(s: StbString);
Expand description

Function pointer a plugin exports to free a StbString it produced. Empty strings require no deallocation. Transfer each non-empty allocation exactly once; freeing another copy of an already-freed string is invalid.

The host calls this for every StbString it receives from the plugin; the plugin calls the host’s free_string (from PluginApi) for every StbString it receives from the host.

§Safety

The caller must transfer a live allocation made by this producer exactly once. Calling with a forged, borrowed or already-freed buffer is invalid.