Skip to main content

export_free_bytes

Macro export_free_bytes 

Source
macro_rules! export_free_bytes {
    ($(#[$meta:meta])* $free_fn:ident) => { ... };
}
Expand description

Declare the release function for byte buffers this library hands out.

The length is taken back because the buffer was a Box<[u8]>: reconstructing it needs the same length the producing call reported. A zero length is ignored rather than reclaimed — an empty boxed slice has no allocation to return.

unparser_shared::export_free_bytes!(
    /// Free a byte buffer produced by this library.
    ///
    /// # Safety
    ///
    /// - `data` must be a pointer this library returned, or null.
    /// - `len` must be the length that call reported.
    demo_release_bytes
);