mirror of
https://github.com/async-rs/async-std.git
synced 2025-04-24 01:06:46 +00:00
Implemented PathBuf::into_os_string
This commit is contained in:
parent
80eaa28552
commit
47ef222dab
1 changed files with 16 additions and 0 deletions
|
@ -35,6 +35,22 @@ impl PathBuf {
|
||||||
let rw = Box::into_raw(self.inner.into_boxed_path()) as *mut Path;
|
let rw = Box::into_raw(self.inner.into_boxed_path()) as *mut Path;
|
||||||
unsafe { Box::from_raw(rw) }
|
unsafe { Box::from_raw(rw) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Consumes the `PathBuf`, yielding its internal [`OsString`] storage.
|
||||||
|
///
|
||||||
|
/// [`OsString`]: https://doc.rust-lang.org/std/ffi/struct.OsString.html
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// use async_std::path::PathBuf;
|
||||||
|
///
|
||||||
|
/// let p = PathBuf::from("/the/head");
|
||||||
|
/// let os_str = p.into_os_string();
|
||||||
|
/// ```
|
||||||
|
pub fn into_os_string(self) -> OsString {
|
||||||
|
self.inner.into_os_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<std::path::PathBuf> for PathBuf {
|
impl From<std::path::PathBuf> for PathBuf {
|
||||||
|
|
Loading…
Reference in a new issue