[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
1 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@
pub mod v0;
mod error;
use core::str::FromStr;
use core::convert::TryFrom;
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)]
mod test {
use super::*;