pub struct Progress<W> { /* private fields */ }
Implementations§
Source§impl<W: Write> Progress<W>
impl<W: Write> Progress<W>
Sourcepub fn new(inner: W, len: u64) -> Self
pub fn new(inner: W, len: u64) -> Self
Examples found in repository?
examples/basic.rs (line 11)
7fn main() {
8 let stdout = io::stdout();
9 let lock = stdout.lock();
10
11 let mut progress = Progress::new(lock, 100);
12
13 for i in 0..=100 {
14 let _ = writeln!(
15 progress,
16 "{n} small step for man, {n} giant leap for mankind",
17 n = i
18 );
19
20 progress.pos(i);
21
22 let _ = progress.render();
23 let _ = progress.render();
24
25 thread::sleep(Duration::from_millis(10));
26 }
27
28 let mut lock = progress.finish();
29
30 let _ = writeln!(lock);
31}
Sourcepub fn pos(&mut self, pos: u64)
pub fn pos(&mut self, pos: u64)
Examples found in repository?
examples/basic.rs (line 20)
7fn main() {
8 let stdout = io::stdout();
9 let lock = stdout.lock();
10
11 let mut progress = Progress::new(lock, 100);
12
13 for i in 0..=100 {
14 let _ = writeln!(
15 progress,
16 "{n} small step for man, {n} giant leap for mankind",
17 n = i
18 );
19
20 progress.pos(i);
21
22 let _ = progress.render();
23 let _ = progress.render();
24
25 thread::sleep(Duration::from_millis(10));
26 }
27
28 let mut lock = progress.finish();
29
30 let _ = writeln!(lock);
31}
Sourcepub fn render(&mut self) -> Result<()>
pub fn render(&mut self) -> Result<()>
Examples found in repository?
examples/basic.rs (line 22)
7fn main() {
8 let stdout = io::stdout();
9 let lock = stdout.lock();
10
11 let mut progress = Progress::new(lock, 100);
12
13 for i in 0..=100 {
14 let _ = writeln!(
15 progress,
16 "{n} small step for man, {n} giant leap for mankind",
17 n = i
18 );
19
20 progress.pos(i);
21
22 let _ = progress.render();
23 let _ = progress.render();
24
25 thread::sleep(Duration::from_millis(10));
26 }
27
28 let mut lock = progress.finish();
29
30 let _ = writeln!(lock);
31}
Sourcepub fn finish(self) -> W
pub fn finish(self) -> W
Examples found in repository?
examples/basic.rs (line 28)
7fn main() {
8 let stdout = io::stdout();
9 let lock = stdout.lock();
10
11 let mut progress = Progress::new(lock, 100);
12
13 for i in 0..=100 {
14 let _ = writeln!(
15 progress,
16 "{n} small step for man, {n} giant leap for mankind",
17 n = i
18 );
19
20 progress.pos(i);
21
22 let _ = progress.render();
23 let _ = progress.render();
24
25 thread::sleep(Duration::from_millis(10));
26 }
27
28 let mut lock = progress.finish();
29
30 let _ = writeln!(lock);
31}
Trait Implementations§
Source§impl<W: Write> Write for Progress<W>
impl<W: Write> Write for Progress<W>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>
fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>
Writes a formatted string into this writer, returning any error
encountered. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Auto Trait Implementations§
impl<W> Freeze for Progress<W>where
W: Freeze,
impl<W> RefUnwindSafe for Progress<W>where
W: RefUnwindSafe,
impl<W> Send for Progress<W>where
W: Send,
impl<W> Sync for Progress<W>where
W: Sync,
impl<W> Unpin for Progress<W>where
W: Unpin,
impl<W> UnwindSafe for Progress<W>where
W: UnwindSafe,
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
Source§impl<W> DetectColors for Wwhere
W: Write,
impl<W> DetectColors for Wwhere
W: Write,
Source§impl<W> DetectCursorPos for Wwhere
W: Write,
impl<W> DetectCursorPos for Wwhere
W: Write,
Source§impl<W> IntoRawMode for Wwhere
W: Write,
impl<W> IntoRawMode for Wwhere
W: Write,
Source§fn into_raw_mode(self) -> Result<RawTerminal<W>, Error>
fn into_raw_mode(self) -> Result<RawTerminal<W>, Error>
Switch to raw mode. Read more