aboutsummaryrefslogtreecommitdiff
path: root/common/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/lib.rs')
-rw-r--r--common/src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/src/lib.rs b/common/src/lib.rs
index 26bf361..8993d22 100644
--- a/common/src/lib.rs
+++ b/common/src/lib.rs
@@ -30,7 +30,7 @@ macro_rules! url_enum {
impl $i {
pub const ALL: &'static [$i] = &[$($i::$vi),*];
pub fn to_str(&self) -> &'static str { match self { $(Self::$vi => $vk),* } }
- pub fn from_str(s: &str) -> Option<Self> { match s { $($vk => Some(Self::$vi) ),*, _ => None } }
+ pub fn from_str_opt(s: &str) -> Option<Self> { match s { $($vk => Some(Self::$vi) ),*, _ => None } }
}
impl std::fmt::Display for $i {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -40,7 +40,7 @@ macro_rules! url_enum {
impl std::str::FromStr for $i {
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
- Self::from_str(s).ok_or(())
+ Self::from_str_opt(s).ok_or(())
}
}
};