From c4b8b554144fb83ecf09faa5ddf77e0dd87e766d Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Sat, 30 Oct 2021 10:36:54 -0400 Subject: [PATCH] [lib] Impl FromStr for UserPreferences --- src/user_preferences/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/user_preferences/mod.rs b/src/user_preferences/mod.rs index aad7529..d5dfc97 100644 --- a/src/user_preferences/mod.rs +++ b/src/user_preferences/mod.rs @@ -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 for UserPreferences { } } +impl FromStr for UserPreferences { + type Err = ParseError; + fn from_str(s: &str) -> Result { + UserPreferences::from_prefstring(s) + } +} + #[cfg(test)] mod test { use super::*;