From f62c7f2a8cc143454779dc99334ca9fc80ddabd5 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 29 Apr 2025 11:10:21 +0200 Subject: still just moving code around --- common/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/src/lib.rs') 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 { match s { $($vk => Some(Self::$vi) ),*, _ => None } } + pub fn from_str_opt(s: &str) -> Option { 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::from_str(s).ok_or(()) + Self::from_str_opt(s).ok_or(()) } } }; -- cgit v1.2.3-70-g09d2