pub struct TimestampTracker { /* private fields */ }Available on crate feature
transport only.Expand description
Timestamp tracker for RTT measurement via timestamp echo.
Each frame carries a timestamp and echoes the peer’s timestamp. When we receive an echo of our timestamp, we can compute RTT.
Implementations§
Source§impl TimestampTracker
impl TimestampTracker
Sourcepub fn with_start(start: Instant) -> Self
pub fn with_start(start: Instant) -> Self
Create a timestamp tracker with a specific start time.
Sourcepub fn timestamp_echo(&self) -> u32
pub fn timestamp_echo(&self) -> u32
Get the timestamp echo value (peer’s last timestamp).
Sourcepub fn on_send(&mut self, timestamp: u32)
pub fn on_send(&mut self, timestamp: u32)
Record that we’re sending a frame with the given timestamp.
Sourcepub fn on_receive(&mut self, peer_timestamp: u32, echo: u32) -> Option<Duration>
pub fn on_receive(&mut self, peer_timestamp: u32, echo: u32) -> Option<Duration>
Process a received frame’s timestamps.
Returns an RTT sample if the echo matches our pending timestamp.
Sourcepub fn clear_pending(&mut self)
pub fn clear_pending(&mut self)
Clear the pending timestamp (e.g., on retransmission).
Trait Implementations§
Source§impl Clone for TimestampTracker
impl Clone for TimestampTracker
Source§fn clone(&self) -> TimestampTracker
fn clone(&self) -> TimestampTracker
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 TimestampTracker
impl Debug for TimestampTracker
Auto Trait Implementations§
impl Freeze for TimestampTracker
impl RefUnwindSafe for TimestampTracker
impl Send for TimestampTracker
impl Sync for TimestampTracker
impl Unpin for TimestampTracker
impl UnwindSafe for TimestampTracker
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