Closed
Description
I'm working on implementing serde::Deserialize
for CStr
(in serde-rs/serde#801), and am running into the need for an equivalent of String::into_boxed_str
for CString
/CStr
. With the current internals for CStr
, I believe the implementation could be very similar; namely:
pub fn into_boxed_cstr(self) -> Box<CStr> {
unsafe { mem::transmute::<Box<[u8]>, Box<CStr>>(self.inner) }
}
Is this something that could be added in line with #18283 ?
Metadata
Metadata
Assignees
Labels
No labels