MaybeSilent

Enum MaybeSilent 

Source
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) -> Self
where 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> Freeze for MaybeSilent<T>
where T: Freeze,

§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.