diff options
| author | Max Audron <audron@cocaine.farm> | 2025-02-26 17:53:08 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2025-02-26 17:53:08 +0100 |
| commit | 6f9c0d0f2906d05e27f9f11af6cefdf006c2cf4b (patch) | |
| tree | 3c92d681f8c98786bf7371ecfece60ed4f8d4a7c /src/primitive/variantlist.rs | |
| parent | add MsgId and BufferId to objects where needed (diff) | |
refactor variant serialization code
Factored out a lot of the serialization of variants into trait's that
have auto impl so code duplication is much reduced
Diffstat (limited to 'src/primitive/variantlist.rs')
| -rw-r--r-- | src/primitive/variantlist.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/primitive/variantlist.rs b/src/primitive/variantlist.rs index 58286e3..ac8cc07 100644 --- a/src/primitive/variantlist.rs +++ b/src/primitive/variantlist.rs @@ -7,6 +7,8 @@ use crate::{deserialize::*, serialize::*}; use crate::primitive::Variant; +use crate::serialize::SerializeVariant; + /// VariantLists are represented as a Vec of Variants. /// /// They are serialized as the amount of entries as a i32 and then a Variant for each entry @@ -45,6 +47,10 @@ impl Deserialize for VariantList { } } +impl SerializeVariant for VariantList { + const TYPE: u32 = crate::primitive::QVARIANTLIST; +} + impl<S> crate::message::NetworkMap for Vec<S> where S: std::convert::TryFrom<Variant> + Into<Variant> + Clone + std::hash::Hash + std::cmp::Eq, |
