pub struct Packet {
    pub flags: PacketFlags,
    pub sequence: u32,
    pub ack: Acknowledgement,
    pub payload: Vec<u8>,
    pub is_meta: bool,
    pub meta: PacketMeta,
}

Fields

flags: PacketFlagssequence: u32ack: Acknowledgementpayload: Vec<u8>is_meta: boolmeta: PacketMeta

Implementations

Create a new Packet

Arguments
  • id - A u32 representing the id of the packet
  • sequence - A u32 representing the sequence number of the packet

Set the packet encrypted flag

Argument
  • enc - Boolean representing if the packet is encrypted or not

Set the packet as a meta packet with the given meta data

Arguments
  • meta - The meta data to assign to this meta packet

Add ack struct into the packet

Arguments
  • ack - A Acknowledgement struct

Append payload Vec to the packet also assigns the length of the packet

Arguments
  • payload - Vec representing the payload of the packet

Compile the data in the packet into packet struct

Arguments
  • ‘self’ - The Packet struct

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.