Wizard

Trait Wizard 

Source
pub trait Wizard: Sized {
    // Required methods
    fn interview() -> Interview;
    fn interview_with_defaults(&self) -> Interview;
    fn from_answers(answers: &Answers) -> Result<Self, BackendError>;

    // Provided method
    fn wizard_builder() -> WizardBuilder<Self> { ... }
}

Required Methods§

Source

fn interview() -> Interview

Get the interview structure for this type

Source

fn interview_with_defaults(&self) -> Interview

Get the interview structure with default values from this instance

Source

fn from_answers(answers: &Answers) -> Result<Self, BackendError>

Build this type from collected answers

Provided Methods§

Source

fn wizard_builder() -> WizardBuilder<Self>

Create a builder for this wizard

Examples found in repository?
examples/nested_wizard.rs (line 43)
42fn main() {
43    let user = User::wizard_builder().build();
44    println!("{user:#?}");
45}
More examples
Hide additional examples
examples/deeply_nested.rs (line 40)
39fn main() {
40    let event = Event::wizard_builder().build();
41    println!("{event:#?}");
42}
examples/nested_enum_payment.rs (line 40)
39fn main() {
40    let order = Order::wizard_builder().build();
41    println!("{:#?}", order);
42}
examples/validation.rs (line 66)
65fn main() {
66    let config = ServerConfig::wizard_builder().build();
67    println!("{config:#?}");
68}
examples/enum_gender.rs (line 51)
50fn main() {
51    let magic = ShowCase::wizard_builder().build();
52    println!("Config: {magic:#?}");
53}
examples/showcase.rs (line 54)
53fn main() {
54    let magic = ShowCase::wizard_builder().build();
55    println!("Config: {magic:#?}");
56}

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§