Struct tty_form::Form

source ·
pub struct Form { /* private fields */ }
Expand description

A TTY-based form with multiple steps and inputs.

Examples

use tty_form::{
    Form,
    step::{Step, CompoundStep, TextBlockStep},
    control::{Control, TextInput},
};

let mut form = Form::new();

let mut name_step = CompoundStep::new();
TextInput::new("Enter a name:", false).add_to(&mut name_step);
name_step.add_to(&mut form);

TextBlockStep::new("Enter a description of this person:").add_to(&mut form);

let submission = form.execute(&mut interface, &mut stdin)?;

Implementations

Create a new, default terminal form.

Append and return a compound step with multiple component controls.

Execute the provided form and return its WYSIWYG result.

Trait Implementations

Create a new, default terminal form.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.