Feature gate: #![feature(pathbuf_into_string)]
This is a tracking issue for rust-lang/libs-team#307
Currently, to convert a PathBuf into a String, you had to first use PathBuf::into_os_string and then OsString::into_string. However, with this feature, you can convert a PathBuf directly into a String using PathBuf::into_string, allowing you to not need to write the intermediate PathBuf::into_os_string.
Public API
// use std::path::Pathbuf;
impl PathBuf {
pub fn into_string(self) -> Result<String, PathBuf> { ... }
}
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
Unresolved Questions
Feature gate:
#![feature(pathbuf_into_string)]This is a tracking issue for rust-lang/libs-team#307
Currently, to convert a
PathBufinto aString, you had to first usePathBuf::into_os_stringand thenOsString::into_string. However, with this feature, you can convert aPathBufdirectly into aStringusingPathBuf::into_string, allowing you to not need to write the intermediatePathBuf::into_os_string.Public API
Steps / History
(Remember to update the
S-tracking-*label when checking boxes.)PathBuf::into_string(that mirrorsOsString::into_string) libs-team#307PathBuf::into_string#156204PathBuf::into_string#156840Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩