Struct aether_lib::packet::Packet
source · [−]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: PacketFlags
sequence: u32
ack: Acknowledgement
payload: Vec<u8>
is_meta: bool
meta: PacketMeta
Implementations
sourceimpl Packet
impl Packet
sourcepub fn new(p_type: PType, sequence: u32) -> Packet
pub fn new(p_type: PType, sequence: u32) -> Packet
Create a new Packet
Arguments
id
- A u32 representing the id of the packetsequence
- A u32 representing the sequence number of the packet
sourcepub fn set_meta(&mut self, meta: PacketMeta)
pub fn set_meta(&mut self, meta: PacketMeta)
Set the packet as a meta packet with the given meta data
Arguments
meta
- The meta data to assign to this meta packet
sourcepub fn add_ack(&mut self, ack: Acknowledgement)
pub fn add_ack(&mut self, ack: Acknowledgement)
sourcepub fn append_payload(&mut self, payload: Vec<u8>)
pub fn append_payload(&mut self, payload: Vec<u8>)
Append payload Vec
Arguments
payload
- Vecrepresenting the payload of the packet
pub fn get_max_header_size(window_size: u16) -> usize
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more