diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-29 11:10:21 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-29 11:10:21 +0200 |
commit | f62c7f2a8cc143454779dc99334ca9fc80ddabd5 (patch) | |
tree | f31dbb908715d2deb2860e2097fa13dd41d759d5 /common/src/lib.rs | |
parent | 73d2d5eb01fceae9e0b1c58afb648822000c878a (diff) | |
download | jellything-f62c7f2a8cc143454779dc99334ca9fc80ddabd5.tar jellything-f62c7f2a8cc143454779dc99334ca9fc80ddabd5.tar.bz2 jellything-f62c7f2a8cc143454779dc99334ca9fc80ddabd5.tar.zst |
still just moving code around
Diffstat (limited to 'common/src/lib.rs')
-rw-r--r-- | common/src/lib.rs | 4 |
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(()) } } }; |