pub struct StepIndicatorState { /* private fields */ }Expand description
State for a StepIndicator component.
Implementations§
Source§impl StepIndicatorState
impl StepIndicatorState
Sourcepub fn new(steps: Vec<Step>) -> Self
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);Sourcepub fn with_orientation(self, orientation: StepOrientation) -> Self
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);Sourcepub fn with_title(self, title: impl Into<String>) -> Self
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"));Sourcepub fn with_connector(self, connector: impl Into<String>) -> Self
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(), "-->");Sourcepub fn with_show_descriptions(self, show: bool) -> Self
pub fn with_show_descriptions(self, show: bool) -> Self
Sets whether descriptions are shown (builder pattern).
Sourcepub fn with_show_border(self, show: bool) -> Self
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());Sourcepub fn step(&self, index: usize) -> Option<&Step>
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());Sourcepub fn orientation(&self) -> &StepOrientation
pub fn orientation(&self) -> &StepOrientation
Returns the orientation.
Sourcepub fn focused_index(&self) -> usize
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);Sourcepub fn active_step_index(&self) -> Option<usize>
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));Sourcepub fn is_all_completed(&self) -> bool
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());Sourcepub fn set_title(&mut self, title: impl Into<String>)
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"));Sourcepub fn show_descriptions(&self) -> bool
pub fn show_descriptions(&self) -> bool
Returns whether descriptions are shown.
§Example
use envision::component::StepIndicatorState;
let state = StepIndicatorState::default();
assert!(!state.show_descriptions());Sourcepub fn show_border(&self) -> bool
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());Sourcepub fn set_show_descriptions(&mut self, show: bool)
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());Sourcepub fn set_orientation(&mut self, orientation: StepOrientation)
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);Sourcepub fn set_show_border(&mut self, show: bool)
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());Sourcepub fn update(
&mut self,
msg: StepIndicatorMessage,
) -> Option<StepIndicatorOutput>
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
impl Clone for StepIndicatorState
Source§fn clone(&self) -> StepIndicatorState
fn clone(&self) -> StepIndicatorState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StepIndicatorState
impl Debug for StepIndicatorState
Source§impl Default for StepIndicatorState
impl Default for StepIndicatorState
Source§impl<'de> Deserialize<'de> for StepIndicatorState
impl<'de> Deserialize<'de> for StepIndicatorState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for StepIndicatorState
impl PartialEq for StepIndicatorState
Source§impl Serialize for StepIndicatorState
impl Serialize for StepIndicatorState
impl Eq for StepIndicatorState
impl StructuralPartialEq for StepIndicatorState
Auto Trait Implementations§
impl Freeze for StepIndicatorState
impl RefUnwindSafe for StepIndicatorState
impl Send for StepIndicatorState
impl Sync for StepIndicatorState
impl Unpin for StepIndicatorState
impl UnsafeUnpin for StepIndicatorState
impl UnwindSafe for StepIndicatorState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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