diff options
| author | Max Audron <me@audron.dev> | 2026-02-21 13:32:00 +0100 |
|---|---|---|
| committer | Max Audron <me@audron.dev> | 2026-02-21 13:32:00 +0100 |
| commit | 8882c121f83cf4513eaee7515d6dcea133a65d69 (patch) | |
| tree | e2818c5d99f209159fd904e0c75d4bc30c262e82 /src/message/signalproxy/objects/chanmodes.rs | |
| parent | remove old readme.org (diff) | |
replace all match_variant instances with try_into
the match_variant macro was unclear, unreadable and no longer needed as
we have automaticly derived from implementations for all Variant enum
fields now
Diffstat (limited to 'src/message/signalproxy/objects/chanmodes.rs')
| -rw-r--r-- | src/message/signalproxy/objects/chanmodes.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/message/signalproxy/objects/chanmodes.rs b/src/message/signalproxy/objects/chanmodes.rs index 1161e28..b297126 100644 --- a/src/message/signalproxy/objects/chanmodes.rs +++ b/src/message/signalproxy/objects/chanmodes.rs @@ -62,20 +62,24 @@ impl NetworkMap for ChanModes { } fn from_network_map(input: &mut Self::Item) -> Self { + let channel_modes_a: VariantMap = input.remove("A").unwrap().try_into().unwrap(); + let channel_modes_b: VariantMap = input.remove("B").unwrap().try_into().unwrap(); + let channel_modes_c: VariantMap = input.remove("C").unwrap().try_into().unwrap(); + ChanModes { - channel_modes_a: match_variant!(input.remove("A").unwrap(), Variant::VariantMap) + channel_modes_a: channel_modes_a .into_iter() - .map(|(mut k, v)| (k.remove(0), match_variant!(v, Variant::StringList))) + .map(|(mut k, v)| (k.remove(0), v.try_into().unwrap())) .collect(), - channel_modes_b: match_variant!(input.remove("B").unwrap(), Variant::VariantMap) + channel_modes_b: channel_modes_b .into_iter() - .map(|(mut k, v)| (k.remove(0), match_variant!(v, Variant::String))) + .map(|(mut k, v)| (k.remove(0), v.try_into().unwrap())) .collect(), - channel_modes_c: match_variant!(input.remove("C").unwrap(), Variant::VariantMap) + channel_modes_c: channel_modes_c .into_iter() - .map(|(mut k, v)| (k.remove(0), match_variant!(v, Variant::String))) + .map(|(mut k, v)| (k.remove(0), v.try_into().unwrap())) .collect(), - channel_modes_d: match_variant!(input.remove("D").unwrap(), Variant::String), + channel_modes_d: input.remove("D").unwrap().try_into().unwrap(), } } } |
