pub struct WriterProgressReporter<W> { /* private fields */ }Expand description
Progress reporter that writes human-readable events to a writer.
§Type Parameters
W- Writer receiving formatted progress events.
§Examples
use std::io::Cursor;
use std::sync::{
Arc,
Mutex,
};
use std::time::Duration;
use qubit_progress::{
ProgressCounters,
ProgressEvent,
ProgressReporter,
WriterProgressReporter,
};
let output = Arc::new(Mutex::new(Cursor::new(Vec::new())));
let reporter = WriterProgressReporter::new(output.clone());
reporter.report(&ProgressEvent::running(
ProgressCounters::new(Some(4)).with_completed_count(2),
Duration::from_secs(1),
));
let bytes = output.lock().expect("output should lock").get_ref().clone();
let text = String::from_utf8(bytes).expect("progress output should be UTF-8");
assert!(text.contains("running"));
assert!(text.contains("2/4"));Implementations§
Source§impl<W> WriterProgressReporter<W>
impl<W> WriterProgressReporter<W>
Trait Implementations§
Source§impl<W: Debug> Debug for WriterProgressReporter<W>
impl<W: Debug> Debug for WriterProgressReporter<W>
Source§impl<W> ProgressReporter for WriterProgressReporter<W>
impl<W> ProgressReporter for WriterProgressReporter<W>
Auto Trait Implementations§
impl<W> Freeze for WriterProgressReporter<W>
impl<W> RefUnwindSafe for WriterProgressReporter<W>
impl<W> Send for WriterProgressReporter<W>where
W: Send,
impl<W> Sync for WriterProgressReporter<W>where
W: Send,
impl<W> Unpin for WriterProgressReporter<W>
impl<W> UnsafeUnpin for WriterProgressReporter<W>
impl<W> UnwindSafe for WriterProgressReporter<W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more