#[unsafe(no_mangle)]pub unsafe extern "C" fn nstd_cstring_from_cstr_unchecked<'a>(
allocator: &'a NSTDAllocator,
cstr: &NSTDCStr,
) -> NSTDOptionalCString<'a>Available on crate feature
cstring only.Expand description
Creates an owned version of an unowned C string slice without checking if the slice contains any null bytes.
§Parameters:
-
const NSTDAllocator *allocator- The memory allocator. -
const NSTDCStr *cstr- The unowned C string slice.
§Returns
NSTDOptionalCString cstring - The new owned version of cstr on success, or an uninitialized
“none” variant if allocating fails.
§Safety
The caller of this function must ensure the following preconditions:
-
cstr’s data is valid for reads. -
cstrdoes not contain any null ('\0') bytes.