alef 0.25.39

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
/// Free a string previously returned by this library.
/// # Safety
/// Pointer must have been returned by this library, or be null.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn {{ prefix }}_free_string(ptr: *mut c_char) {
    if !ptr.is_null() {
        // SAFETY: ptr was allocated by CString::into_raw; caller ensures no aliases.
        unsafe { drop(CString::from_raw(ptr)); }
    }
}