pub struct FramePacer { /* private fields */ }Available on crate feature
transport only.Expand description
Frame pacer that controls when frames can be sent.
The pacer ensures:
- Minimum interval between frames (SRTT/2 or 20ms, whichever is greater)
- Collection interval to batch rapid state changes (8ms)
- Delayed ACK to piggyback on data frames (100ms max)
- Frame rate cap at 50 Hz
Implementations§
Source§impl FramePacer
impl FramePacer
Sourcepub fn on_state_change(&mut self)
pub fn on_state_change(&mut self)
Notify the pacer that local state has changed.
Sourcepub fn on_ack_needed(&mut self)
pub fn on_ack_needed(&mut self)
Notify the pacer that we received a frame and should send an ACK.
Sourcepub fn on_frame_sent(&mut self)
pub fn on_frame_sent(&mut self)
Notify the pacer that a frame was sent.
Sourcepub fn clear_pending(&mut self)
pub fn clear_pending(&mut self)
Clear pending state (e.g., after receiving ACK).
Sourcepub fn poll(&self) -> PacerAction
pub fn poll(&self) -> PacerAction
Determine what action to take based on current state.
Sourcepub fn needs_keepalive(&self, last_received: Instant) -> bool
pub fn needs_keepalive(&self, last_received: Instant) -> bool
Check if we should send a keepalive.
Sourcepub fn is_connection_dead(&self, last_received: Instant) -> bool
pub fn is_connection_dead(&self, last_received: Instant) -> bool
Check if the connection should be considered dead.
Trait Implementations§
Source§impl Clone for FramePacer
impl Clone for FramePacer
Source§fn clone(&self) -> FramePacer
fn clone(&self) -> FramePacer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FramePacer
impl Debug for FramePacer
Auto Trait Implementations§
impl Freeze for FramePacer
impl RefUnwindSafe for FramePacer
impl Send for FramePacer
impl Sync for FramePacer
impl Unpin for FramePacer
impl UnwindSafe for FramePacer
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