pub trait Buffered: WithAttributes {
// Provided methods
fn buffered(&self, buffering: Buffering) -> Self { ... }
fn get_buffering(&self) -> Buffering { ... }
fn is_buffered(&self) -> bool { ... }
}
Expand description
Determine scope buffering strategy, if supported by output. Changing this only affects scopes opened afterwards. Buffering is done on best effort, meaning flush will occur if buffer capacity is exceeded.
Provided Methods§
sourcefn buffered(&self, buffering: Buffering) -> Self
fn buffered(&self, buffering: Buffering) -> Self
Return a clone with the specified buffering set.
Examples found in repository?
examples/buffered_flush_on_drop.rs (line 9)
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
fn main() {
let input = Stream::write_to_stdout().buffered(Buffering::Unlimited);
loop {
println!("\n------- open scope");
let metrics = input.metrics();
metrics.marker("marker_a").mark();
sleep(Duration::from_millis(1000));
println!("------- close scope: ");
}
}
sourcefn get_buffering(&self) -> Buffering
fn get_buffering(&self) -> Buffering
Return the current buffering strategy.
sourcefn is_buffered(&self) -> bool
fn is_buffered(&self) -> bool
Returns false if the current buffering strategy is Buffering::Unbuffered
.
Returns true otherwise.
Object Safety§
This trait is not object safe.