[−][src]Struct naia_shared::StandardHeader
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]
p_type: PacketType,
local_packet_index: u16,
last_remote_packet_index: u16,
bit_field: u32,
host_tick: u16,
last_received_tick: u16
) -> 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.
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]
pub fn clone(&self) -> StandardHeader
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for StandardHeader
[src]
impl Debug for StandardHeader
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,