pub unsafe fn cstr_as_str<'a>(ptr: *const c_char) -> &'a strExpand description
Convert a C string pointer into a borrowed string slice.
§Safety
- Assumes
ptris a valid, null-terminated UTF-8 C string pointer. - The returned
&strborrows the underlying allocation; callers must ensure the C buffer outlives every use of the string slice.
§Panics
Panics if ptr is null or contains invalid UTF-8.