[][src]Function stats::thread_local_aggregator::schedule_stats_aggregation_preview

pub fn schedule_stats_aggregation_preview(
) -> Result<Pin<Box<dyn NewFuture<Output = ()> + Send>>, StatsScheduledErrorPreview>

Upon the first call to this function it will return a future that results in periodically calling aggregation of stats. On subsequent calls it will return Error::StatsScheduled that contain the future, so that the caller might still use it, but knows that it is not the first this function was called.

Examples

use stats::schedule_stats_aggregation_preview;
use tokio::spawn;

let s = schedule_stats_aggregation_preview().unwrap();
spawn(s);