pub struct InputSender<T> { /* private fields */ }Expand description
Client-side bounded input history and redundant packet builder.
Implementations§
Source§impl<T> InputSender<T>
impl<T> InputSender<T>
Sourcepub fn new(config: InputSenderConfig) -> NetcodeResult<Self>
pub fn new(config: InputSenderConfig) -> NetcodeResult<Self>
Creates an input sender whose first generated sequence is one.
Sourcepub fn with_next_sequence(
config: InputSenderConfig,
next_sequence: u64,
) -> NetcodeResult<Self>
pub fn with_next_sequence( config: InputSenderConfig, next_sequence: u64, ) -> NetcodeResult<Self>
Creates an input sender with an application-restored next sequence.
Sourcepub fn record(&mut self, target_tick: u64, input: T) -> NetcodeResult<u64>
pub fn record(&mut self, target_tick: u64, input: T) -> NetcodeResult<u64>
Records one input and returns its assigned sequence.
Sourcepub fn acknowledge(&mut self, acknowledgement: InputAck) -> NetcodeResult<usize>
pub fn acknowledge(&mut self, acknowledgement: InputAck) -> NetcodeResult<usize>
Applies a cumulative server acknowledgement and returns the number of released inputs.
Sourcepub fn acknowledged_sequence(&self) -> u64
pub fn acknowledged_sequence(&self) -> u64
Returns the highest input sequence cumulatively acknowledged by the server.
Sourcepub fn acknowledged_server_tick(&self) -> u64
pub fn acknowledged_server_tick(&self) -> u64
Returns the highest authoritative server Tick observed in an acknowledgement.
Sourcepub fn pending_len(&self) -> usize
pub fn pending_len(&self) -> usize
Returns the number of unacknowledged inputs retained locally.
Source§impl<T: Clone> InputSender<T>
impl<T: Clone> InputSender<T>
Sourcepub fn packet(&self, client_tick: u64) -> InputPacket<T>
pub fn packet(&self, client_tick: u64) -> InputPacket<T>
Builds a packet containing the newest configured number of unacknowledged inputs.
Trait Implementations§
Source§impl<T: Clone> Clone for InputSender<T>
impl<T: Clone> Clone for InputSender<T>
Source§fn clone(&self) -> InputSender<T>
fn clone(&self) -> InputSender<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for InputSender<T>
impl<T> RefUnwindSafe for InputSender<T>where
T: RefUnwindSafe,
impl<T> Send for InputSender<T>where
T: Send,
impl<T> Sync for InputSender<T>where
T: Sync,
impl<T> Unpin for InputSender<T>where
T: Unpin,
impl<T> UnsafeUnpin for InputSender<T>
impl<T> UnwindSafe for InputSender<T>where
T: UnwindSafe,
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