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
sender_ack_index: PacketIndex
sender_ack_bitfield: u32
Implementations
sourceimpl 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
sourceimpl Clone for StandardHeader
impl Clone for StandardHeader
sourcefn clone(&self) -> StandardHeader
fn clone(&self) -> StandardHeader
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StandardHeader
impl Debug for StandardHeader
sourceimpl PartialEq<StandardHeader> for StandardHeader
impl PartialEq<StandardHeader> for StandardHeader
sourcefn 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 ==
. Read more
sourcefn ne(&self, other: &StandardHeader) -> bool
fn ne(&self, other: &StandardHeader) -> bool
This method tests for !=
.
sourceimpl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more