pub enum MaybeSilent<T> {
    Silent,
    Loud(T),
}
Expand description

An enum wrapper for a progress bar or spinner that might be silent.

Variants§

§

Silent

There is no progress

§

Loud(T)

There is progress

Implementations§

source§

impl<T> MaybeSilent<T>

source

pub fn is_loud(&self) -> bool

Is this the not silent variant?

source

pub fn is_silent(&self) -> bool

Is this the silent variant?

source

pub const fn new_some(value: T) -> Self

Create a new MaybeSilent with a value.

source

pub fn new<U>(from: U) -> Selfwhere U: Into<Option<T>>,

Create a new MaybeSilent with a potential value

source

pub fn as_ref(&self) -> Option<&T>

Get a reference to the inner type if possible

source

pub fn as_mut(&mut self) -> Option<&mut T>

Get a mutable reference to the inner type if possible

source

pub fn as_display_mut(&mut self) -> Option<&mut (dyn Display + 'static)>where T: Display + 'static,

Get a dynamic mutable reference to the internal value if it is Display.

source

pub fn into_inner(self) -> Option<T>

Consume this instance and return the inner value if possible

source

pub fn into_silent(self) -> Option<Silent>

Consume this instance and return silent if it had no value

source

pub fn as_bar_mut(&mut self) -> Option<&mut (dyn ProgressBar + 'static)>where T: ProgressBar + 'static,

Get a dynamic mutable reference to the internal value if it is ProgressBar

source

pub fn as_spinner_mut(&mut self) -> Option<&mut (dyn Spinner + 'static)>where T: Spinner + 'static,

Get a dynamic mutable reference to the internal value if it is Spinner.

source

pub fn as_display(&self) -> Option<&(dyn Display + 'static)>where T: Display + 'static,

Get a dynamic reference to the internal value if it is Display.

source

pub fn as_bar(&self) -> Option<&(dyn ProgressBar + 'static)>where T: ProgressBar + 'static,

Get a dynamic reference to the internal value if it is ProgressBar

source

pub fn as_spinner(&self) -> Option<&(dyn Spinner + 'static)>where T: Spinner + 'static,

Get a dynamic reference to the internal value if it is Spinner.

Trait Implementations§

source§

impl<T: Debug> Debug for MaybeSilent<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Display for MaybeSilent<T>where T: Display,

source§

fn refresh(&self)

Refresh the display
source§

fn blank(&self)

Blank the display
source§

fn println(&self, string: &str)

Blank then print a line, and redisplay.
source§

fn eprintln(&self, string: &str)

Blank then print a line std stderr, and redisplay.
source§

fn get_title(&self) -> &str

Get the title for this display
source§

fn set_title(&mut self, from: &str)

Set the title for this display
source§

fn update_dimensions(&mut self, to: usize)

Update the max size if needed
source§

impl<T> From<MaybeSilent<T>> for Option<T>

source§

fn from(from: MaybeSilent<T>) -> Self

Converts to this type from the input type.
source§

impl<T> From<Option<T>> for MaybeSilent<T>

source§

fn from(from: Option<T>) -> Self

Converts to this type from the input type.
source§

impl<T> ProgressBar for MaybeSilent<T>where T: ProgressBar,

source§

fn set_progress(&mut self, value: f64)

source§

fn get_progress(&self) -> f64

source§

impl<T> Spinner for MaybeSilent<T>where T: Spinner,

source§

fn bump(&mut self)

Cause the spinner to increment once.
source§

impl<T> WithTitle for MaybeSilent<T>where T: WithTitle,

A trait for creating a progress bar or spinner with a title.

source§

fn add_title(&mut self, string: impl AsRef<str>)

Add a title to this indicator.
source§

fn with_title(self, string: impl AsRef<str>) -> Self

Add a title to this indicator.
source§

fn update(&mut self)

source§

fn complete(self)

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for MaybeSilent<T>where T: RefUnwindSafe,

§

impl<T> Send for MaybeSilent<T>where T: Send,

§

impl<T> Sync for MaybeSilent<T>where T: Sync,

§

impl<T> Unpin for MaybeSilent<T>where T: Unpin,

§

impl<T> UnwindSafe for MaybeSilent<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.