Skip to main content

lift_str

Function lift_str 

Source
pub unsafe fn lift_str<'a>(ptr: *const u8, len: usize) -> Option<&'a str>
Expand description

Borrow a (ptr, len) string parameter as a &str, validating UTF-8, without copying.

Returns None when ptr is null but len isn’t 0, or when the bytes aren’t valid UTF-8.

§Safety

Same contract as lift_byte_slice.