tower_load/
lib.rs

1//! Abstractions and utilties for measuring a service's load.
2
3#![doc(html_root_url = "https://docs.rs/tower-load/0.3.0")]
4#![warn(
5    missing_debug_implementations,
6    missing_docs,
7    rust_2018_idioms,
8    unreachable_pub
9)]
10#![allow(elided_lifetimes_in_paths)]
11
12mod constant;
13mod instrument;
14pub mod peak_ewma;
15pub mod pending_requests;
16
17pub use self::{
18    constant::Constant,
19    instrument::{Instrument, InstrumentFuture, NoInstrument},
20    peak_ewma::{PeakEwma, PeakEwmaDiscover},
21    pending_requests::{PendingRequests, PendingRequestsDiscover},
22};
23
24/// Exposes a load metric.
25pub trait Load {
26    /// A comparable load metric. Lesser values are "preferable" to greater values.
27    type Metric: PartialOrd;
28
29    /// Obtains a service's load.
30    fn load(&self) -> Self::Metric;
31}