Skip to main content

SetupWizard

Struct SetupWizard 

Source
pub struct SetupWizard<'a, Msg> { /* private fields */ }
Expand description

The first-run wizard: the appearance step the framework draws and drives, then a step for each one the application adds, on the Wizard every other flow uses.

The first step asks for the language, the theme and the icons as Appearance rows, each with its “In every Quvyta application” box, and shows the same icons in all three glyph modes so the user chooses by eye. Without a Nerd Font on the machine it offers to install the symbols, shows how far the install is and, once it is done, what to look at (nerd_font::after_install_text). Under the rows, “Start with the defaults” writes what is filled in and ends the wizard.

Build it in view from the Setup the application holds; see Setup for the whole of it.

Implementations§

Source§

impl<'a, Msg: Clone + Send + 'static> SetupWizard<'a, Msg>

Source

pub fn new(setup: &'a Setup<Msg>) -> Self

The wizard of setup, with the appearance step alone.

Source

pub fn step( self, title: impl Into<String>, page: impl FnOnce(&mut View<'_, Msg>) + 'a, ) -> Self

Adds a step of the application’s own, named title, whose page is built by page and whose messages are the application’s. Steps come in the order they are added, after the appearance step.

Source

pub fn on_cancel(self, message: Msg) -> Self

Adds a Cancel button, and makes Esc inside the wizard send message too. Closing the wizard writes nothing at all, so the application usually quits on it and the wizard comes again next start.

Source

pub fn page_height(self, rows: u16) -> Self

Gives every step exactly rows rows, so the buttons stay put between steps.

Source

pub fn show<'v>(self, ui: &'v mut View<'_, Msg>) -> NodeMut<'v, Msg>

Adds the wizard to ui.

Auto Trait Implementations§

§

impl<'a, Msg> !RefUnwindSafe for SetupWizard<'a, Msg>

§

impl<'a, Msg> !Send for SetupWizard<'a, Msg>

§

impl<'a, Msg> !Sync for SetupWizard<'a, Msg>

§

impl<'a, Msg> !UnwindSafe for SetupWizard<'a, Msg>

§

impl<'a, Msg> Freeze for SetupWizard<'a, Msg>
where &'a Setup<Msg>: Freeze, Vec<(String, Box<dyn FnOnce(&mut View<'_, Msg>) + 'a>)>: Freeze, Option<Msg>: Freeze,

§

impl<'a, Msg> Unpin for SetupWizard<'a, Msg>
where &'a Setup<Msg>: Unpin, Vec<(String, Box<dyn FnOnce(&mut View<'_, Msg>) + 'a>)>: Unpin, Option<Msg>: Unpin,

§

impl<'a, Msg> UnsafeUnpin for SetupWizard<'a, Msg>
where &'a Setup<Msg>: UnsafeUnpin, Vec<(String, Box<dyn FnOnce(&mut View<'_, Msg>) + 'a>)>: UnsafeUnpin, Option<Msg>: UnsafeUnpin,

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.