[][src]Struct slog_extlog::stats::StatsConfigBuilder

pub struct StatsConfigBuilder<T: StatisticsLogFormatter> { /* fields omitted */ }

A builder to allow customization of stats config. This gives flexibility when the other methods are insufficient.

Create the builder using new() and chain other methods as required, ending with fuse() to return the StatsConfig.

Example

Creating a config with a custom stats interval and the default formatter.


slog_extlog::define_stats! {
    MY_STATS = {
        SomeStat(Counter, "A test counter", []),
        SomeOtherStat(Counter, "Another test counter", [])
    }
}

let full_stats = vec![MY_STATS];
let cfg = StatsConfigBuilder::<DefaultStatisticsLogFormatter>::new()
             .with_stats(full_stats)
             .with_log_interval(30)
             .fuse();

Implementations

impl<T: StatisticsLogFormatter> StatsConfigBuilder<T>[src]

pub fn new() -> Self[src]

Create a new config builder, using the given formatter.

The formatter must be provided here as it is intrinsic to the builder.

pub fn with_stats(self, defns: Vec<StatDefinitions>) -> Self[src]

Set the list of statistics to track.

pub fn with_log_interval(self, interval: u64) -> Self[src]

Set the logging interval.

pub fn with_runtime(self, handle: Handle) -> Self[src]

Set the Tokio reactor core to use for the logging of the statistics.

pub fn fuse(self) -> StatsConfig<T>[src]

Return the built configuration.

Trait Implementations

impl<T> Default for StatsConfigBuilder<T> where
    T: StatisticsLogFormatter
[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for StatsConfigBuilder<T>

impl<T> Send for StatsConfigBuilder<T> where
    T: Send

impl<T> Sync for StatsConfigBuilder<T> where
    T: Sync

impl<T> Unpin for StatsConfigBuilder<T> where
    T: Unpin

impl<T> !UnwindSafe for StatsConfigBuilder<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.