diff options
Diffstat (limited to 'src/path.rs')
-rw-r--r-- | src/path.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/path.rs b/src/path.rs index 2e599bf..c566b9c 100644 --- a/src/path.rs +++ b/src/path.rs @@ -175,6 +175,16 @@ impl std::str::FromStr for DirectoryName { } +impl std::str::FromStr for GenericPathComponent { + type Err = PathError; + + fn from_str(input: &str) -> std::result::Result<Self, Self::Err> { + parser::PathComponentParser::new().parse(input).map_err( + |e| PathError::Parse(e.to_string())) + } +} + + impl AbsoluteDirectoryPath { pub fn to_sys_path(&self) -> std::path::PathBuf { let mut result = std::path::PathBuf::new(); |