From d45e0a687ed5aa78f3e80bc5c335312bd81b2d4c Mon Sep 17 00:00:00 2001 From: Max Audron Date: Sun, 27 Jul 2025 01:51:14 +0200 Subject: temporarly fix nested network repr parsing for variant types --- src/message/signalproxy/objects/network.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/message/signalproxy/objects/network.rs') diff --git a/src/message/signalproxy/objects/network.rs b/src/message/signalproxy/objects/network.rs index 693abfe..138f63f 100644 --- a/src/message/signalproxy/objects/network.rs +++ b/src/message/signalproxy/objects/network.rs @@ -9,7 +9,7 @@ use libquassel_derive::{sync, NetworkMap, Setters}; use crate::error::ProtocolError; use crate::message::signalproxy::translation::NetworkMap; -use crate::message::{Class, Syncable}; +use crate::message::{Class, NetworkList, Syncable}; use crate::primitive::{Variant, VariantList, VariantMap}; use crate::serialize::{Deserialize, Serialize, UserType}; @@ -617,6 +617,20 @@ pub struct NetworkServer { pub proxy_pass: String, } +// TODO this is not correct usage, it's technically not really network repr were converting from +// but just the conversion of VariantList -> Self directly +// we have this problem since now we have generic VariantList impls +// for all the variants and this type is now also directly a variant +impl NetworkList for Vec { + fn to_network_list(&self) -> super::VariantList { + self.iter().map(|b| Variant::NetworkServer(b.clone())).collect() + } + + fn from_network_list(input: &mut super::VariantList) -> Self { + input.iter().map(|b| match_variant!(b, Variant::NetworkServer)).collect() + } +} + impl UserType for NetworkServer { const NAME: &str = "Network::Server"; } -- cgit v1.2.3