Skip to content

Commit

Permalink
Add TryFrom<&'a OsStr> for PdCString
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenByteDev committed Aug 11, 2023
1 parent 2464cbd commit f7b0559
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pdcstring/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ impl<'a> TryFrom<&'a str> for PdCString {
}
}

impl<'a> TryFrom<&'a OsStr> for PdCString {
type Error = ContainsNul;

fn try_from(s: &'a OsStr) -> Result<Self, Self::Error> {
Self::from_os_str(s)
}
}

impl TryFrom<Vec<PdUChar>> for PdCString {
type Error = ContainsNul;

Expand Down

0 comments on commit f7b0559

Please sign in to comment.