pub struct CommandDecoder;Expand description
Deserializes commands from network bytes.
Implementations§
Source§impl CommandDecoder
impl CommandDecoder
Sourcepub fn decode_command(cursor: &mut Cursor<&[u8]>) -> Result<ProtocolCommand>
pub fn decode_command(cursor: &mut Cursor<&[u8]>) -> Result<ProtocolCommand>
Decodes a single command from a cursor
Sourcepub fn decode_packet(data: &[u8]) -> Result<CommandPacket>
pub fn decode_packet(data: &[u8]) -> Result<CommandPacket>
Decodes a command packet containing multiple commands
Sourcepub fn validate_and_strip_checksum(data: &[u8]) -> Result<&[u8]>
pub fn validate_and_strip_checksum(data: &[u8]) -> Result<&[u8]>
Validates and strips the CRC32 checksum from packet data. Returns the data without checksum if valid, or an error if checksum fails.
This is a convenience wrapper around the checksum module’s validation function.
Auto Trait Implementations§
impl Freeze for CommandDecoder
impl RefUnwindSafe for CommandDecoder
impl Send for CommandDecoder
impl Sync for CommandDecoder
impl Unpin for CommandDecoder
impl UnwindSafe for CommandDecoder
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