Trait dipstick::QueuedInput
source · pub trait QueuedInput: Input + Send + Sync + 'static + Sized {
// Provided method
fn queued(self, max_size: usize) -> InputQueue { ... }
}
Expand description
Wrap this output behind an asynchronous metrics dispatch queue. This is not strictly required for multi threading since the provided scopes are already Send + Sync but might be desired to lower the latency
Provided Methods§
sourcefn queued(self, max_size: usize) -> InputQueue
fn queued(self, max_size: usize) -> InputQueue
Wrap this output with an asynchronous dispatch queue of specified length.
Examples found in repository?
examples/async_queue.rs (line 9)
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
fn main() {
let async_metrics = Stream::write_to_stdout().queued(100).metrics();
let counter = async_metrics.counter("counter_a");
for _ in 0..4 {
let counter = counter.clone();
thread::spawn(move || {
loop {
// report some metric values from our "application" loop
counter.count(11);
sleep(Duration::from_millis(50));
}
});
}
sleep(Duration::from_secs(5000));
}
Object Safety§
This trait is not object safe.