pub struct StableOsString { /* private fields */ }Expand description
A safe way to send an OsString (or PathBuf) across an abi/ffi boundary. Unlike OsString and OsStr, it has an encoding that will not change based on the compiler version, and it uses #[repr(C)].
Note: there is no OsStr equivalent because copying the inner data may be necessary
Implementations§
Source§impl StableOsString
impl StableOsString
Sourcepub fn into_os_string(self) -> OsString
pub fn into_os_string(self) -> OsString
Converts this back into an OsString
Sourcepub fn into_path_buf(self) -> PathBuf
pub fn into_path_buf(self) -> PathBuf
Converts this into a PathBuf
Sourcepub unsafe fn from_vec(data: Vec<EncodingWidth>) -> Self
pub unsafe fn from_vec(data: Vec<EncodingWidth>) -> Self
Constructs a new StableOsString from raw data.
§Safety
The given bytes must be compatible with the target platform’s OsStr encoding (reminder: this crate only make it safe to pass data between different rust versions)
Sourcepub fn into_vec(self) -> Vec<EncodingWidth> ⓘ
pub fn into_vec(self) -> Vec<EncodingWidth> ⓘ
Converts self back into raw data.
Trait Implementations§
Source§impl Clone for StableOsString
impl Clone for StableOsString
Source§impl Debug for StableOsString
impl Debug for StableOsString
Source§impl Default for StableOsString
impl Default for StableOsString
Source§impl Drop for StableOsString
impl Drop for StableOsString
impl Eq for StableOsString
Source§impl Hash for StableOsString
impl Hash for StableOsString
Auto Trait Implementations§
impl !Send for StableOsString
impl !Sync for StableOsString
impl Freeze for StableOsString
impl RefUnwindSafe for StableOsString
impl Unpin for StableOsString
impl UnsafeUnpin for StableOsString
impl UnwindSafe for StableOsString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more