[][src]Struct naia_shared::StandardHeader

pub struct StandardHeader { /* fields omitted */ }

This header provides reliability information.

Implementations

impl StandardHeader[src]

pub fn new(
    p_type: PacketType,
    local_packet_index: u16,
    last_remote_packet_index: u16,
    bit_field: u32,
    host_tick: u16,
    last_received_tick: u16
) -> StandardHeader
[src]

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.

pub const fn bytes_number() -> usize[src]

Returns the number of bytes in the header

pub fn packet_type(&self) -> PacketType[src]

Returns the packet type indicated by the header

pub fn local_packet_index(&self) -> u16[src]

Returns the sequence number from this packet.

pub fn ack_field(&self) -> u32[src]

Returns bit field of all last 32 acknowledged packages.

pub fn last_remote_packet_index(&self) -> u16[src]

Returns last acknowledged sequence number.

pub fn host_tick(&self) -> u16[src]

Returns the current tick of the sending Host

pub fn last_received_tick(&self) -> u16[src]

Returns the last received tick from the remote Host

pub fn write(&self, buffer: &mut Vec<u8>)[src]

Writes the header to an outgoing byte buffer

pub fn read(msg: &[u8]) -> (Self, Box<[u8]>)[src]

Reads the header from an incoming byte slice

Trait Implementations

impl Clone for StandardHeader[src]

impl Copy for StandardHeader[src]

impl Debug for StandardHeader[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,