pub fn vec_to_cstr(bytes: Vec<u8>) -> Cow<'static, CStr>
Expand description
Converts a Vec<u8>
into a null-terminated CStr
.
Truncates the vector at the first null byte, if present. If no null byte exists, appends one to ensure proper termination.
ยงReturns
A Cow<'_, CStr>
containing a guaranteed null-terminated string.