From 8882c121f83cf4513eaee7515d6dcea133a65d69 Mon Sep 17 00:00:00 2001 From: Max Audron Date: Sat, 21 Feb 2026 13:32:00 +0100 Subject: 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 --- src/message/handshake/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/message/handshake/mod.rs') diff --git a/src/message/handshake/mod.rs b/src/message/handshake/mod.rs index 022b71f..9bcbe6e 100644 --- a/src/message/handshake/mod.rs +++ b/src/message/handshake/mod.rs @@ -56,9 +56,9 @@ impl HandshakeSerialize for HandshakeMessage { impl HandshakeDeserialize for HandshakeMessage { fn parse(b: &[u8]) -> Result<(usize, Self), ProtocolError> { - let (size, res) = VariantMap::parse(b)?; + let (size, mut res) = VariantMap::parse(b)?; - let msgtype: String = (&res["MsgType"]).into(); + let msgtype: String = res.remove("MsgType").unwrap().try_into().unwrap(); match msgtype.as_str() { "ClientInit" => Ok((size, HandshakeMessage::ClientInit(res.into()))), "ClientInitAck" => Ok((size, HandshakeMessage::ClientInitAck(res.into()))), -- cgit v1.2.3