Function dipstick::fnsink::make_sink [] [src]

pub fn make_sink<M, MF, WF>(make_metric: MF, make_scope: WF) -> FnSink<M> where
    MF: Fn(Kind, &str, Rate) -> M + Send + Sync + 'static,
    WF: Fn(Scope<M>) + Send + Sync + 'static,
    M: Send + Sync

Compose a sink dynamically using a generic FnSink. Two methods have to be provided: One to make new metrics and one to create scopes.

Using this is often simpler than implementing the Sink trait. This is especially well suited to stateless I/O sinks.

Performance impact of method delegation should be negligible when compared actual method cost for most use cases.