diff options
| author | Max Audron <audron@cocaine.farm> | 2025-07-27 01:51:14 +0200 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2025-07-27 01:51:14 +0200 |
| commit | d45e0a687ed5aa78f3e80bc5c335312bd81b2d4c (patch) | |
| tree | c93c3cb6839b707202f678d25dab0752182948c4 /src/message/signalproxy/objects/network.rs | |
| parent | fix sessioninit message wrongly using NetworkMap to convert a field (diff) | |
temporarly fix nested network repr parsing for variant types
Diffstat (limited to 'src/message/signalproxy/objects/network.rs')
| -rw-r--r-- | src/message/signalproxy/objects/network.rs | 16 |
1 files changed, 15 insertions, 1 deletions
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<NetworkServer> { + 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"; } |
