ffi_string_from_buffer_or_empty

Function ffi_string_from_buffer_or_empty 

Source
pub unsafe fn ffi_string_from_buffer_or_empty<F>(
    buffer_size: usize,
    ffi_call: F,
) -> String
where F: FnOnce(*mut i8, isize) -> bool,
Expand description

Same as ffi_string_from_buffer but returns an empty string on failure instead of None.

Useful when the API should always return a string, even if empty.

ยงSafety

The caller must ensure that the FFI call writes valid UTF-8 data to the buffer.