Skip to main content

Wire

Struct Wire 

Source
pub struct Wire(/* private fields */);
Expand description

One connection’s cumulative wire counters, which its transport updates as it sends and receives: its bytes, its sender’s losses and waits on the congestion controller and on the peer’s connection-level credit, and its receiver’s holds on a spent receive window.

Clones share the counters, so stats read them without polling the session or keeping the connection alive, and the final totals stay readable after it closes. Each counter is independent: a transport records the ones it tracks, and the rest stay zero.

A transport whose counts live outside it, such as a TCP socket’s in the kernel, builds its counters with Wire::from_source instead of pushing them as it carries traffic.

Implementations§

Source§

impl Wire

Source

pub fn new() -> Self

Create counters that start at zero.

Source

pub fn from_source(source: impl WireSource) -> Self

Create counters that start at zero and that source refreshes whenever stats read them.

Source

pub fn sent_bytes(&self) -> u64

The bytes sent so far, including transport framing and retransmissions.

Source

pub fn received_bytes(&self) -> u64

The bytes received so far, including transport framing.

Source

pub fn set_sent_bytes(&self, total: u64)

Record the cumulative bytes sent so far.

Source

pub fn set_received_bytes(&self, total: u64)

Record the cumulative bytes received so far.

Source

pub fn lost_bytes(&self) -> u64

The sent bytes declared lost so far, part of Self::sent_bytes.

Source

pub fn set_lost_bytes(&self, total: u64)

Record the cumulative sent bytes declared lost so far.

Source

pub fn cwnd_blocked(&self) -> Duration

How long data ready to send waited on a full congestion window.

Source

pub fn pacing_blocked(&self) -> Duration

How long data ready to send waited on the pacer.

Source

pub fn set_congestion_blocked(&self, cwnd: Duration, pacing: Duration)

Record the cumulative time data ready to send waited on the congestion controller: on a full cwnd, or on the pacing that spreads sends at its rate.

Source

pub fn credit_stalls(&self) -> u64

How many times the sender blocked with all the peer’s connection credit (MAX_DATA) spent.

Source

pub fn credit_stalled(&self) -> Duration

How long the sender spent blocked on the peer’s connection credit.

Source

pub fn set_credit_stalls(&self, stalls: u64, stalled: Duration)

Record the cumulative episodes and time the sender spent blocked on the peer’s connection credit. An episode starts when a write blocks with every credited byte sent, and ends when the peer grants more; a write held by the local send window is not one.

Source

pub fn credit_held_readers(&self) -> Duration

How long the peer had this side’s whole receive window spent while a reader had data it had not looked at yet: a reader behind holding the window.

Source

pub fn credit_held_evicted(&self) -> Duration

How long the peer had this side’s whole receive window spent while an evicted reader had not stopped its stream.

Source

pub fn set_credit_held(&self, readers: Duration, evicted: Duration)

Record the cumulative time the peer had the whole receive window spent while eviction waited on readers behind or on evicted readers yet to stop their streams.

Trait Implementations§

Source§

impl Clone for Wire

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Wire

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Wire

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Wire

§

impl !UnwindSafe for Wire

§

impl Freeze for Wire

§

impl Send for Wire

§

impl Sync for Wire

§

impl Unpin for Wire

§

impl UnsafeUnpin for Wire

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more