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 d7464df commit 35d9901Copy full SHA for 35d9901
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};
@@ -1446,6 +1448,15 @@ impl From<String> for PathBuf {
1446
1448
}
1447
1449
1450
1451
+#[stable(feature = "path_from_str", since = "1.26.0")]
1452
+impl FromStr for PathBuf {
1453
+ type Err = ParseError;
1454
+
1455
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
1456
+ Ok(PathBuf::from(s))
1457
+ }
1458
+}
1459
1460
#[stable(feature = "rust1", since = "1.0.0")]
1461
impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
1462
fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
0 commit comments