We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cbbd70d commit a0df420Copy full SHA for a0df420
src/libstd/path.rs
@@ -87,6 +87,8 @@ use io;
87
use iter::{self, FusedIterator};
88
use ops::{self, Deref};
89
use rc::Rc;
90
+use str::FromStr;
91
+use string::ParseError;
92
use sync::Arc;
93
94
use ffi::{OsStr, OsString};
@@ -1443,6 +1445,15 @@ impl From<String> for PathBuf {
1443
1445
}
1444
1446
1447
1448
+#[stable(feature = "path_from_str", since = "1.26.0")]
1449
+impl FromStr for PathBuf {
1450
+ type Err = ParseError;
1451
+
1452
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
1453
+ Ok(PathBuf::from(s))
1454
+ }
1455
+}
1456
1457
#[stable(feature = "rust1", since = "1.0.0")]
1458
impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
1459
fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
0 commit comments