Function async_layer

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

Returns a layer that will call an async callback on each relevant event. 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.