Struct SenderBaselines

Source
pub struct SenderBaselines { /* private fields */ }
Expand description

Exact sent bytes with ACK authorization, separate from installed state. See the module recipe for the required send/install/ACK sequence.

Implementations§

Source§

impl SenderBaselines

Source

pub fn new(limits: BaselineLimits) -> Result<SenderBaselines, BaselineError>

Fallibly preallocate both budgets. No implicit FPS/game defaults.

Source

pub fn record_sent( &mut self, tick: u32, bytes: &[u8], ) -> Result<RetainOutcome, BaselineError>

Record full reconstructed bytes only after the caller’s send succeeds. Failed sends must not be recorded. This does not send or authorize bytes. Preflight snapshot size when guaranteed retention before send is needed; an over-budget successful send cannot subsequently be ACKed here.

Source

pub fn acknowledge(&mut self, tick: u32) -> AckOutcome

Authenticate the session externally first. Exact retained membership is mandatory; a newer unknown tick never authorizes bytes. An older retained generation cannot roll authorization back, even after eviction of the acknowledged generation. ACKs do not refresh eviction order.

Source

pub fn baseline(&self) -> Option<(u32, &[u8])>

Currently authorized retained bytes. Eviction returns None; the ACK watermark alone is never sufficient to select a delta.

Source

pub fn select_into( &self, tick: u32, full: &[u8], delta: &mut Delta, envelope_bytes: usize, packet_limit: usize, ) -> Selection

Select against exact ACKed retained bytes using checked Delta. envelope_bytes is the entire outer overhead (24 for current v5 packets), and packet_limit is the caller’s transport/protocol bound. Delta must fit that bound and be strictly smaller than full.len(). Overflow, incompatible lengths, codec limits and insufficient Delta capacity select full without mutation. No encoding, retention or ACK is implicit. Outer full-packet validation, tick acceptance and encoding failures remain caller policy; a full outcome does not authorize sending a stale tick.

Source

pub fn get(&self, tick: u32) -> Option<&[u8]>

Exact retained sent bytes; lookup does not authorize them.

Source

pub fn len(&self) -> usize

Current snapshot count, including empty snapshots.

Source

pub fn is_empty(&self) -> bool

Whether there are no retained snapshots.

Source

pub fn retained_bytes(&self) -> usize

Sum of retained byte lengths, without a separate acknowledged copy.

Source

pub fn latest_tick(&self) -> Option<u32>

Last retained tick; duplicates do not change it.

Source

pub fn reset(&mut self)

Clear bytes, ACK watermark, ticks and generations, retaining allocations. Suitable for authenticated full recovery or session reset. See the module session-epoch requirement; reset does not filter delayed packets.

Trait Implementations§

Source§

impl Debug for SenderBaselines

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.