Struct naia_shared::StandardHeader
source · pub struct StandardHeader {
pub packet_type: PacketType,
pub sender_packet_index: PacketIndex,
pub sender_ack_index: PacketIndex,
pub sender_ack_bitfield: u32,
}
Fields§
§packet_type: PacketType
§sender_packet_index: PacketIndex
Packet index identifying this packet
sender_ack_index: PacketIndex
This is the last acknowledged sequence number.
sender_ack_bitfield: u32
This is an bitfield of all last 32 acknowledged packages
Implementations§
source§impl StandardHeader
impl StandardHeader
sourcepub fn new(
packet_type: PacketType,
sender_packet_index: PacketIndex,
sender_ack_index: PacketIndex,
sender_ack_bitfield: u32
) -> StandardHeader
pub fn new( packet_type: PacketType, sender_packet_index: PacketIndex, sender_ack_index: PacketIndex, sender_ack_bitfield: u32 ) -> StandardHeader
When we compose packet headers, the local sequence becomes the sequence
number of the packet, and the remote sequence becomes the ack.
The ack bitfield is calculated by looking into a queue of up to 33
packets, containing sequence numbers in the range [remote sequence - 32, remote sequence]
. We set bit n (in [1,32]
) in ack bits to 1 if the
sequence number remote sequence - n is in the received queue.
Trait Implementations§
source§impl Clone for StandardHeader
impl Clone for StandardHeader
source§fn clone(&self) -> StandardHeader
fn clone(&self) -> StandardHeader
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for StandardHeader
impl Debug for StandardHeader
source§impl PartialEq for StandardHeader
impl PartialEq for StandardHeader
source§fn eq(&self, other: &StandardHeader) -> bool
fn eq(&self, other: &StandardHeader) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serde for StandardHeader
impl Serde for StandardHeader
impl Copy for StandardHeader
impl StructuralPartialEq for StandardHeader
Auto Trait Implementations§
impl RefUnwindSafe for StandardHeader
impl Send for StandardHeader
impl Sync for StandardHeader
impl Unpin for StandardHeader
impl UnwindSafe for StandardHeader
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