Function async_layer_with_spans

Source
pub fn async_layer_with_spans<F, Fut>(
    buffer_size: usize,
    callback: F,
) -> CallbackLayerWithSpan
where F: Fn(OwnedEventWithSpans) -> Fut + Send + Sync + 'static, Fut: Future<Output = ()> + Send + 'static,
Expand description

Returns a layer that will call an async callback on each relevant event along with parent spans. This type of layer can be used, for example, to save tracing events into a database.

Note that this is NOT an async closure but a normal function that returns a future. In practice that will often be a function whose return value is an async block that is not awaited.