Skip to main content

StepIndicatorState

Struct StepIndicatorState 

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

State for a StepIndicator component.

Implementations§

Source§

impl StepIndicatorState

Source

pub fn new(steps: Vec<Step>) -> Self

Creates a new step indicator with the given steps.

§Example
use envision::component::step_indicator::{Step, StepStatus};
use envision::component::StepIndicatorState;

let steps = vec![
    Step::new("Step 1").with_status(StepStatus::Completed),
    Step::new("Step 2").with_status(StepStatus::Active),
    Step::new("Step 3"),
];
let state = StepIndicatorState::new(steps);
assert_eq!(state.steps().len(), 3);
Source

pub fn with_orientation(self, orientation: StepOrientation) -> Self

Sets the orientation (builder pattern).

§Example
use envision::component::step_indicator::{Step, StepOrientation};
use envision::component::StepIndicatorState;

let state = StepIndicatorState::new(vec![Step::new("A")])
    .with_orientation(StepOrientation::Vertical);
assert_eq!(state.orientation(), &StepOrientation::Vertical);
Source

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

Sets the title (builder pattern).

§Example
use envision::component::step_indicator::Step;
use envision::component::StepIndicatorState;

let state = StepIndicatorState::new(vec![Step::new("A")])
    .with_title("Pipeline");
assert_eq!(state.title(), Some("Pipeline"));
Source

pub fn with_connector(self, connector: impl Into<String>) -> Self

Sets the connector string (builder pattern).

§Example
use envision::component::step_indicator::Step;
use envision::component::StepIndicatorState;

let state = StepIndicatorState::new(vec![Step::new("A")])
    .with_connector("-->");
assert_eq!(state.connector(), "-->");
Source

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

Sets whether descriptions are shown (builder pattern).

Source

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

Sets whether the border is shown (builder pattern).

Defaults to true. When set to false, the StepIndicator renders its steps directly into the full widget area with no surrounding box — useful for inline breadcrumbs and single-row layouts.

§Title interaction

When the border is hidden, the state’s title is not rendered. The title is drawn as part of the border block, so disabling the border silently suppresses it. If you want this to be explicit, set the title to None.

§Example
use envision::component::step_indicator::Step;
use envision::component::StepIndicatorState;

let state = StepIndicatorState::new(vec![Step::new("A")])
    .with_show_border(false);
assert!(!state.show_border());
Source

pub fn steps(&self) -> &[Step]

Returns the steps.

Source

pub fn step(&self, index: usize) -> Option<&Step>

Returns a specific step, if it exists.

§Example
use envision::component::step_indicator::Step;
use envision::component::StepIndicatorState;

let state = StepIndicatorState::new(vec![Step::new("Build"), Step::new("Test")]);
assert_eq!(state.step(0).unwrap().label(), "Build");
assert!(state.step(99).is_none());
Source

pub fn orientation(&self) -> &StepOrientation

Returns the orientation.

Source

pub fn focused_index(&self) -> usize

Returns the focused step index.

§Example
use envision::component::step_indicator::Step;
use envision::component::StepIndicatorState;

let state = StepIndicatorState::new(vec![Step::new("A"), Step::new("B")]);
assert_eq!(state.focused_index(), 0);
Source

pub fn active_step_index(&self) -> Option<usize>

Returns the index of the currently active step, if any.

§Example
use envision::component::step_indicator::{Step, StepStatus};
use envision::component::StepIndicatorState;

let state = StepIndicatorState::new(vec![
    Step::new("Build").with_status(StepStatus::Completed),
    Step::new("Test").with_status(StepStatus::Active),
    Step::new("Deploy"),
]);
assert_eq!(state.active_step_index(), Some(1));
Source

pub fn is_all_completed(&self) -> bool

Returns true if all steps are completed.

§Example
use envision::component::step_indicator::{Step, StepStatus};
use envision::component::StepIndicatorState;

let state = StepIndicatorState::new(vec![
    Step::new("Build").with_status(StepStatus::Completed),
    Step::new("Test").with_status(StepStatus::Completed),
]);
assert!(state.is_all_completed());
Source

pub fn connector(&self) -> &str

Returns the connector string.

Source

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

Returns the title, if any.

Source

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

Sets the title.

§Example
use envision::component::StepIndicatorState;
use envision::component::step_indicator::Step;

let mut state = StepIndicatorState::new(vec![Step::new("Step 1")]);
state.set_title("Progress");
assert_eq!(state.title(), Some("Progress"));
Source

pub fn show_descriptions(&self) -> bool

Returns whether descriptions are shown.

§Example
use envision::component::StepIndicatorState;

let state = StepIndicatorState::default();
assert!(!state.show_descriptions());
Source

pub fn show_border(&self) -> bool

Returns whether the border is shown.

§Example
use envision::component::StepIndicatorState;

let state = StepIndicatorState::default();
assert!(state.show_border());
Source

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

Sets whether descriptions are shown.

§Example
use envision::component::StepIndicatorState;
use envision::component::step_indicator::Step;

let mut state = StepIndicatorState::new(vec![Step::new("A"), Step::new("B")]);
state.set_show_descriptions(true);
assert!(state.show_descriptions());
Source

pub fn set_orientation(&mut self, orientation: StepOrientation)

Sets the orientation.

§Example
use envision::component::StepIndicatorState;
use envision::component::step_indicator::{Step, StepOrientation};

let mut state = StepIndicatorState::new(vec![Step::new("A"), Step::new("B")]);
state.set_orientation(StepOrientation::Vertical);
assert_eq!(state.orientation(), &StepOrientation::Vertical);
Source

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

Sets whether the border is shown.

See with_show_border for the title interaction when show is false.

§Example
use envision::component::StepIndicatorState;
use envision::component::step_indicator::Step;

let mut state = StepIndicatorState::new(vec![Step::new("A")]);
state.set_show_border(false);
assert!(!state.show_border());
Source

pub fn update( &mut self, msg: StepIndicatorMessage, ) -> Option<StepIndicatorOutput>

Updates the state with a message, returning any output.

§Example
use envision::component::{StepIndicatorState, StepIndicatorMessage, StepIndicatorOutput};
use envision::component::step_indicator::{Step, StepStatus};

let steps = vec![
    Step::new("Build").with_status(StepStatus::Active),
    Step::new("Test"),
];
let mut state = StepIndicatorState::new(steps);
let output = state.update(StepIndicatorMessage::CompleteActive);
assert!(matches!(output, Some(StepIndicatorOutput::StatusChanged { .. })));

Trait Implementations§

Source§

impl Clone for StepIndicatorState

Source§

fn clone(&self) -> StepIndicatorState

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 StepIndicatorState

Source§

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

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

impl Default for StepIndicatorState

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for StepIndicatorState

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 StepIndicatorState

Source§

fn eq(&self, other: &StepIndicatorState) -> 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 StepIndicatorState

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 Eq for StepIndicatorState

Source§

impl StructuralPartialEq for StepIndicatorState

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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>,