pub struct Packet {
pub version: u8,
pub payload: Vec<u8>,
}Expand description
Represents a fully decoded protocol packet
Fields§
§version: u8§payload: Vec<u8>Implementations§
Trait Implementations§
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
Returns ProtocolError::OversizedPacket if the payload is larger than
MAX_PAYLOAD_SIZE, which the receiving side would reject.
Source§type Error = ProtocolError
type Error = ProtocolError
The type of encoding errors. Read more
Auto Trait Implementations§
impl Freeze for Packet
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnsafeUnpin for Packet
impl UnwindSafe for Packet
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