[−][src]Trait metered::metric::Enter
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
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.