Skip to main content

MultiProgressState

Struct MultiProgressState 

Source
pub struct MultiProgressState { /* private fields */ }
Expand description

State for the MultiProgress component.

Implementations§

Source§

impl MultiProgressState

Source

pub fn new() -> Self

Creates a new empty MultiProgress state.

Source

pub fn with_max_visible(self, max: usize) -> Self

Sets the maximum number of visible items.

Source

pub fn with_auto_remove(self, auto_remove: bool) -> Self

Sets whether to auto-remove completed items.

Source

pub fn with_title(self, title: impl Into<String>) -> Self

Sets the title.

Source

pub fn with_percentages(self, show: bool) -> Self

Sets whether to show percentages.

Source

pub fn add(&mut self, id: impl Into<String>, label: impl Into<String>) -> bool

Adds a new progress item.

Returns true if the item was added (id was unique).

Source

pub fn items(&self) -> &[ProgressItem]

Returns all items.

Source

pub fn len(&self) -> usize

Returns the number of items.

Source

pub fn is_empty(&self) -> bool

Returns true if there are no items.

Source

pub fn completed_count(&self) -> usize

Returns the number of completed items.

Source

pub fn failed_count(&self) -> usize

Returns the number of failed items.

Source

pub fn active_count(&self) -> usize

Returns the number of active items.

Source

pub fn overall_progress(&self) -> f32

Returns the overall progress (average of all items).

Source

pub fn find(&self, id: &str) -> Option<&ProgressItem>

Finds an item by ID.

Source

pub fn find_mut(&mut self, id: &str) -> Option<&mut ProgressItem>

Finds a mutable item by ID.

Source

pub fn remove(&mut self, id: &str) -> bool

Removes an item by ID.

Source

pub fn clear(&mut self)

Clears all items.

Source

pub fn max_visible(&self) -> usize

Returns the maximum visible items.

Source

pub fn set_max_visible(&mut self, max: usize)

Sets the maximum visible items.

Source

pub fn scroll_offset(&self) -> usize

Returns the scroll offset.

Source

pub fn set_scroll_offset(&mut self, offset: usize)

Sets the scroll offset.

Source

pub fn title(&self) -> Option<&str>

Returns the title.

Source

pub fn set_title(&mut self, title: Option<String>)

Sets the title.

Source

pub fn show_percentages(&self) -> bool

Returns whether percentages are shown.

Source

pub fn set_show_percentages(&mut self, show: bool)

Sets whether to show percentages.

Source

pub fn auto_remove_completed(&self) -> bool

Returns whether auto-remove is enabled.

Source

pub fn set_auto_remove_completed(&mut self, auto_remove: bool)

Sets whether to auto-remove completed items.

Source

pub fn is_focused(&self) -> bool

Returns true if the multi-progress is focused.

Source

pub fn set_focused(&mut self, focused: bool)

Sets the focus state.

Source

pub fn is_disabled(&self) -> bool

Returns true if the multi-progress is disabled.

Source

pub fn set_disabled(&mut self, disabled: bool)

Sets the disabled state.

Source

pub fn with_disabled(self, disabled: bool) -> Self

Sets the disabled state using builder pattern.

Source

pub fn handle_event(&self, event: &Event) -> Option<MultiProgressMessage>

Maps an input event to a multi-progress message.

Source

pub fn dispatch_event(&mut self, event: &Event) -> Option<MultiProgressOutput>

Dispatches an event, updating state and returning any output.

Source

pub fn update( &mut self, msg: MultiProgressMessage, ) -> Option<MultiProgressOutput>

Updates the multi-progress state with a message, returning any output.

Trait Implementations§

Source§

impl Clone for MultiProgressState

Source§

fn clone(&self) -> MultiProgressState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MultiProgressState

Source§

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

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

impl Default for MultiProgressState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for MultiProgressState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for MultiProgressState

Source§

fn eq(&self, other: &MultiProgressState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MultiProgressState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MultiProgressState

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> StateExt for T

Source§

fn updated(self, cmd: Command<impl Clone>) -> UpdateResult<Self, impl Clone>

Updates self and returns a command.
Source§

fn unchanged(self) -> UpdateResult<Self, ()>

Returns self with no command.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,