pub struct Codec {
pub registry: PacketRegistry,
}Expand description
The Serializer & Deserializer for a pack
Fields§
§registry: PacketRegistryThe packet registry
Implementations§
Source§impl Codec
impl Codec
Sourcepub fn new(registry: PacketRegistry) -> Codec
pub fn new(registry: PacketRegistry) -> Codec
Creates a new Codec instance
Sourcepub fn serialize(&self, packet: &Box<dyn Packet>) -> SonetReadBuf
pub fn serialize(&self, packet: &Box<dyn Packet>) -> SonetReadBuf
Serializes the packet object into a ReadBuffer
Sourcepub fn deserialize(
&self,
buffer: &mut SonetReadBuf,
) -> Box<dyn Packet + Send + Sync>
pub fn deserialize( &self, buffer: &mut SonetReadBuf, ) -> Box<dyn Packet + Send + Sync>
Deserializes the ReadBuffer into a packet instance
Auto Trait Implementations§
impl Freeze for Codec
impl !RefUnwindSafe for Codec
impl Send for Codec
impl Sync for Codec
impl Unpin for Codec
impl !UnwindSafe for Codec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more