Skip to main content

WizardStep

Trait WizardStep 

Source
pub trait WizardStep<S>: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn prompt<'life0, 'life1, 'async_trait>(
        &'life0 self,
        state: &'life1 mut S,
    ) -> Pin<Box<dyn Future<Output = Result<StepOutcome, InquireError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

One stage in a Wizard.

Implementations issue one or more inquire prompts, mutate state with the captured values, and return a StepOutcome. inquire::InquireError::OperationCanceled (Esc) is mapped to StepOutcome::Back by the wizard driver — implementations just ?-propagate.

Required Methods§

Source

fn name(&self) -> &'static str

Stable identifier for this step. Used in error messages and the test harness.

Source

fn prompt<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 mut S, ) -> Pin<Box<dyn Future<Output = Result<StepOutcome, InquireError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run the step. See trait-level docs for navigation semantics.

§Errors

Surface any InquireError the step encounters. OperationCanceled is mapped to Back by the driver; OperationInterrupted short-circuits the wizard with WizardError::Interrupted; other variants surface as WizardError::Step.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§