We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 037119c commit d8e52c1Copy full SHA for d8e52c1
src/path/pathbuf.rs
@@ -1,6 +1,7 @@
1
use std::ffi::{OsStr, OsString};
2
#[cfg(feature = "unstable")]
3
use std::pin::Pin;
4
+use std::str::FromStr;
5
6
use crate::path::Path;
7
@@ -228,6 +229,14 @@ impl From<&str> for PathBuf {
228
229
}
230
231
232
+impl FromStr for PathBuf {
233
+ type Err = core::convert::Infallible;
234
+
235
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
236
+ Ok(std::path::PathBuf::from(s).into())
237
+ }
238
+}
239
240
impl AsRef<Path> for PathBuf {
241
fn as_ref(&self) -> &Path {
242
Path::new(&self.inner)
0 commit comments