aboutsummaryrefslogtreecommitdiff
path: root/src/primitive/bufferid.rs
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2025-07-27 01:51:14 +0200
committerMax Audron <audron@cocaine.farm>2025-07-27 01:51:14 +0200
commitd45e0a687ed5aa78f3e80bc5c335312bd81b2d4c (patch)
treec93c3cb6839b707202f678d25dab0752182948c4 /src/primitive/bufferid.rs
parentfix sessioninit message wrongly using NetworkMap to convert a field (diff)
temporarly fix nested network repr parsing for variant types
Diffstat (limited to 'src/primitive/bufferid.rs')
-rw-r--r--src/primitive/bufferid.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/primitive/bufferid.rs b/src/primitive/bufferid.rs
index e987d85..59e1ace 100644
--- a/src/primitive/bufferid.rs
+++ b/src/primitive/bufferid.rs
@@ -2,10 +2,13 @@
#[repr(transparent)]
pub struct BufferId(pub i32);
+use crate::message::NetworkList;
use crate::{error::ProtocolError, serialize::*};
use crate::serialize::UserType;
+use super::Variant;
+
impl Serialize for BufferId {
fn serialize(&self) -> Result<Vec<u8>, ProtocolError> {
let mut res = Vec::new();
@@ -42,6 +45,19 @@ impl UserType for BufferId {
const NAME: &str = "BufferId";
}
+// TODO this is not correct usage, it's technically not really network repr were converting from
+// but just the conversion of VariantList -> Self directly
+impl NetworkList for Vec<BufferId> {
+ fn to_network_list(&self) -> super::VariantList {
+ self.iter().map(|b| Variant::BufferId(*b)).collect()
+ }
+
+ fn from_network_list(input: &mut super::VariantList) -> Self {
+ input.iter().map(|b| match_variant!(b, Variant::BufferId)).collect()
+ }
+}
+
+
#[cfg(test)]
mod tests {
use super::*;
pan class='insertions'>+2 2021-06-13fix crash on message only containing whitespaceMax Audron-1/+4 2021-06-11Release version 1.2.01.2.0Max Audron-2/+2 2021-06-06make pet more compactR0flcopt3r/catinator-pet-commandMax Audron-5/+5 2021-06-05feat: adds pet command.R0flcopt3r-0/+90 2021-06-05feat: send actionR0flcopt3r-1/+9 2021-06-05release version 1.1.0Max Audron-2/+2 2021-06-05document proc macrosMax Audron-4/+97 2021-06-05add intensifyMax Audron-3/+27 2021-06-05add privmsg macroMax Audron-2/+40 2021-06-05fix jb remote urlsMax Audron-4/+4 2021-06-05remove egress gateway configMax Audron-10/+0 2021-06-05update tanka dependenciesMax Audron-8/+8 2021-06-05fix init container nameMax Audron-1/+1 2021-06-05fix tanka dependency pathMax Audron-8/+8 2021-06-05switch to https url for tanka util libMax Audron-2/+2 2021-06-05bump version to 1.0.2Max Audron-2/+2 2021-06-05add tanka ci configurationMax Audron-1/+1 2021-06-05ready tanka deploy for CIMax Audron-32/+69 2021-06-05remove tanka vendoringMax Audron-27651/+0 2021-05-26Release 1.0.1Max Audron-3/+3 2021-05-26fix log breaking once buffer fullMax Audron-2/+33 2021-05-16add deployment stuffMax Audron-6/+27786 2021-05-15add container buildMax Audron-2/+35