[][src]Trait metered::Enter

pub trait Enter {
    type E;
    fn enter(&self) -> Self::E;
}

Re-export this type so 3rd-party crates don't need to depend on the aspect-rs crate. The Enter trait is called when entering in an aspect, before the wrapped expression is called.

Associated Types

type E

The type returned by the enter function and carried to OnResult

Loading content...

Required methods

fn enter(&self) -> Self::E

enter is called when entering in an aspect

Use it to set-up some context before calling the expression. For instance, the ResponseTime metric in the metered crate uses it to get the current time before the invocation, and pass it over to OnResult to compute the elapsed time.

Aspects which don't need enter can simply do nothing and return unit.

Loading content...

Implementors

impl<C: Counter> Enter for ErrorCount<C>[src]

type E = ()

impl<C: Counter> Enter for HitCount<C>[src]

type E = ()

impl<G: Gauge> Enter for InFlight<G>[src]

type E = ()

impl<H: Histogram, T: Instant> Enter for ResponseTime<H, T>[src]

type E = T

impl<P: RecordThroughput, T: Instant> Enter for Throughput<T, P>[src]

type E = ()

Loading content...