Skip to main content

cstr_required

Function cstr_required 

Source
pub unsafe fn cstr_required(ptr: *const c_char, what: &str) -> Result<String>
Expand description

Copy a UTF-8 C string, returning an error for null or invalid UTF-8.

ยงSafety

If non-null, ptr must point to a NUL-terminated string in a single readable allocation of at most isize::MAX bytes, including the terminator. The bytes must remain valid and unchanged for this call.