Added packets folder for the packet-service until I automate generation at build time

This commit is contained in:
2025-07-23 13:59:08 -04:00
parent f10cac3794
commit d39e3405bb
200 changed files with 12512 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
/* This file is @generated with IDL v0.2.2 */
use crate::dataconsts::*;
use crate::enums::*;
use crate::packet::PacketPayload;
use crate::types::*;
use bincode::de::read::Reader;
use bincode::enc::write::Writer;
use bincode::{de::Decoder, enc::Encoder, error::DecodeError, Decode, Encode};
use utils::null_string::NullTerminatedString;
#[derive(Debug)]
pub struct CliMessengerChat {
pub(crate) tag: u16,
pub(crate) message: NullTerminatedString,
}
impl PacketPayload for CliMessengerChat {}
impl Encode for CliMessengerChat {
fn encode<E: Encoder>(&self, encoder: &mut E) -> std::result::Result<(), bincode::error::EncodeError> {
self.tag.encode(encoder)?;
self.message.encode(encoder)?;
Ok(())
}
}
impl<Context> Decode<Context> for CliMessengerChat {
fn decode<D: Decoder>(decoder: &mut D) -> std::result::Result<Self, bincode::error::DecodeError> {
let tag = u16::decode(decoder)?;
let message = NullTerminatedString::decode(decoder)?;
Ok(Self { tag, message })
}
}