pub struct Wizard<Msg> { /* private fields */ }Expand description
A flow of pages the user goes through in order: Steps on top, the current step’s page,
and a row of buttons.
The application owns the current step and every value. Next sends the next message; the
application validates the step there and either advances or returns
FormErrors::focus_first, so a broken step blocks the flow
with focus on the problem. On the last step Next reads Finish and sends the finish message.
Back is shown from the second step on.
Capabilities, each off until asked for: Wizard::on_cancel adds a Cancel button and makes
Esc inside the wizard cancel; Wizard::on_step lets people go back by choosing a finished
step; Wizard::busy shows Next working and ignores it; Wizard::page_height keeps the
buttons in place across pages of different heights.
The buttons are named wizard-cancel, wizard-back and wizard-next, so
Command::focus("wizard-next") reaches them. Their words are quvyta.wizard.cancel,
back, next and finish.
Implementations§
Source§impl<Msg: Clone + 'static> Wizard<Msg>
impl<Msg: Clone + 'static> Wizard<Msg>
Sourcepub fn new(labels: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn new(labels: impl IntoIterator<Item = impl Into<String>>) -> Self
A wizard with steps named labels, on the first step.
Sourcepub fn on_cancel(self, message: Msg) -> Self
pub fn on_cancel(self, message: Msg) -> Self
Adds a Cancel button; Esc inside the wizard sends the same message.
Sourcepub fn on_step(self, message: impl Fn(usize) -> Msg + 'static) -> Self
pub fn on_step(self, message: impl Fn(usize) -> Msg + 'static) -> Self
Lets finished steps be chosen to go back to them; the message carries the step.
Sourcepub fn busy(self, busy: bool) -> Self
pub fn busy(self, busy: bool) -> Self
Shows Next (or Finish) working and ignores it, e.g. while the last step is applied.
Sourcepub fn page_height(self, rows: u16) -> Self
pub fn page_height(self, rows: u16) -> Self
Gives every page exactly rows rows, so the buttons stay put between steps.
Auto Trait Implementations§
impl<Msg> !RefUnwindSafe for Wizard<Msg>
impl<Msg> !Send for Wizard<Msg>
impl<Msg> !Sync for Wizard<Msg>
impl<Msg> !UnwindSafe for Wizard<Msg>
impl<Msg> Freeze for Wizard<Msg>
impl<Msg> Unpin for Wizard<Msg>
impl<Msg> UnsafeUnpin for Wizard<Msg>
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> 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