pub struct State { /* private fields */ }Expand description
Current state of Progress.
This is used with custom item and returned by Progress::state.
See custom item for an example.
Implementations§
Source§impl State
impl State
Sourcepub fn eta(&self) -> Option<Duration>
pub fn eta(&self) -> Option<Duration>
Returns estimated time remaining or None if estimate is not available.
Estimate is based on completed steps and time of latest completion.
Estimate is available if
totalisSomeand- at least one step and at most
totalsteps have been completed and - at least 100 ms has elapsed since
Progresscreation.
See custom item for an example.
Sourcepub fn pos(&self) -> u64
pub fn pos(&self) -> u64
Returns position.
§Examples
use ml_progress::progress;
let progress = progress!(10)?;
progress.inc(6);
assert_eq!(progress.state().lock().pos(), 6);Sourcepub fn thousands_separator(&self) -> &str
pub fn thousands_separator(&self) -> &str
Returns thousands separator.
Separator can be set with ProgressBuilder::thousands_separator,
default is space.
§Examples
use ml_progress::progress_builder;
let progress = progress_builder!().thousands_separator(",").build()?;
assert_eq!(progress.state().lock().thousands_separator(), ",");Auto Trait Implementations§
impl Freeze for State
impl !RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnsafeUnpin for State
impl !UnwindSafe for State
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