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/handshake/clientinit.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 '')
| -rw-r--r-- | src/message/handshake/clientinit.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/message/handshake/clientinit.rs b/src/message/handshake/clientinit.rs index 32e8595..94d52cf 100644 --- a/src/message/handshake/clientinit.rs +++ b/src/message/handshake/clientinit.rs @@ -64,12 +64,12 @@ impl HandshakeSerialize for ClientInit { } impl From<VariantMap> for ClientInit { - fn from(input: VariantMap) -> Self { + fn from(mut input: VariantMap) -> Self { ClientInit { - client_version: match_variant!(input.get("ClientVersion").unwrap(), Variant::String), - client_date: match_variant!(input.get("ClientDate").unwrap(), Variant::String), - client_features: match_variant!(input.get("Features").unwrap(), Variant::u32), - feature_list: match_variant!(input.get("FeatureList").unwrap(), Variant::StringList), + client_version: input.remove("ClientVersion").unwrap().try_into().unwrap(), + client_date: input.remove("ClientDate").unwrap().try_into().unwrap(), + client_features: input.remove("Features").unwrap().try_into().unwrap(), + feature_list: input.remove("FeatureList").unwrap().try_into().unwrap(), } } } |
