pub struct PacketCodec;Trait Implementations§
Source§impl Decoder for PacketCodec
impl Decoder for PacketCodec
Source§fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Packet>>
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Packet>>
Decodes a packet from the byte stream
Returns None if there aren’t enough bytes to form a complete packet.
§Errors
Returns ProtocolError::InvalidPacket if the packet data is malformed
Source§type Error = ProtocolError
type Error = ProtocolError
The type of unrecoverable frame decoding errors. Read more
Source§impl Encoder<Packet> for PacketCodec
impl Encoder<Packet> for PacketCodec
Source§fn encode(&mut self, packet: Packet, dst: &mut BytesMut) -> Result<()>
fn encode(&mut self, packet: Packet, dst: &mut BytesMut) -> Result<()>
Encodes a packet into the byte stream
§Errors
This method should never fail under normal conditions, but may return protocol errors if there are internal serialization issues
Source§type Error = ProtocolError
type Error = ProtocolError
The type of encoding errors. Read more
Auto Trait Implementations§
impl Freeze for PacketCodec
impl RefUnwindSafe for PacketCodec
impl Send for PacketCodec
impl Sync for PacketCodec
impl Unpin for PacketCodec
impl UnwindSafe for PacketCodec
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