pub struct ProgressBar { /* private fields */ }Expand description
Represents a progress bar
Implementations§
Source§impl ProgressBar
impl ProgressBar
Sourcepub fn new(
id: &str,
unique_name: Option<&str>,
len: ProgressValue,
msg: &str,
failure_message: &str,
progress_type: ProgressType,
progress_action: ProgressAction,
) -> Self
pub fn new( id: &str, unique_name: Option<&str>, len: ProgressValue, msg: &str, failure_message: &str, progress_type: ProgressType, progress_action: ProgressAction, ) -> Self
Create a new progress bar This will begin reporting the progress bar to the log
§Arguments
id- The ID of the progress barunique_name- The unique name of the mod this progress bar is for, pass None if the progress bar doesn’t know what mod it’s forlen- The length of the progress barmsg- The message of the progress barfailure_message- The message to show if the progress bar failsprogress_type- The type of progress barprogress_action- The action this progress bar is reporting
§Returns
The new progress bar Note that if this is dropped without calling finish, it will be considered a failure, so make sure to call finish!
Sourcepub fn inc(&mut self, amount: ProgressValue)
pub fn inc(&mut self, amount: ProgressValue)
Increment the progress bar This will throttle the amount of times the progress bar can be incremented, so an increment may not emit a log line This is done to prevent spamming small increments
Sourcepub fn finish(&mut self, success: bool, msg: &str)
pub fn finish(&mut self, success: bool, msg: &str)
Finish the progress bar
This will emit a log line with the final message of the progress bar This function should always be called when the progress bar is done, as a drop will result in a failure
§Arguments
success- Whether the progress bar succeeded or failedmsg- The message of the progress bar, this will be ignored if the progress bar failed, and will instead use the failure message passed initially
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProgressBar
impl RefUnwindSafe for ProgressBar
impl Send for ProgressBar
impl Sync for ProgressBar
impl Unpin for ProgressBar
impl UnwindSafe for ProgressBar
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more