[lib] Impl FromStr for UserPreferences

This commit is contained in:
Emi Simpson 2021-10-30 10:36:54 -04:00
parent 7fb9ed0119
commit c4b8b55414
Signed by: Emi
GPG key ID: A12F2C2FFDC3D847

View file

@ -6,6 +6,7 @@
pub mod v0; pub mod v0;
mod error; mod error;
use core::str::FromStr;
use core::convert::TryFrom; use core::convert::TryFrom;
pub use error::ParseError; pub use error::ParseError;
@ -164,6 +165,13 @@ impl TryFrom<Intermediary> for UserPreferences {
} }
} }
impl FromStr for UserPreferences {
type Err = ParseError;
fn from_str(s: &str) -> Result<Self, ParseError> {
UserPreferences::from_prefstring(s)
}
}
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;