Skip to main content

WireSource

Trait WireSource 

Source
pub trait WireSource:
    Send
    + Sync
    + 'static {
    // Required method
    fn refresh(&self, wire: &Wire);
}
Expand description

Reads a connection’s counters on demand, for a transport that cannot cheaply push them as it sends and receives, such as a TCP socket whose kernel counts its bytes.

Stats call it on every report and once more when the connection’s stats end, so the counters are current whenever stats read them, and an idle connection needs no timer. Anyone else reading a sourced Wire sees the counts as of the last stats read.

Required Methods§

Source

fn refresh(&self, wire: &Wire)

Copy the counts this source tracks into wire, leaving the rest as they are.

Never keep a clone of wire: it owns this source, so the pair would never drop.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§