Trait requestty_ui::Prompt
source · [−]pub trait Prompt: Widget {
type ValidateErr: Widget;
type Output;
fn finish(self) -> Self::Output;
fn validate(&mut self) -> Result<Validation, Self::ValidateErr> { ... }
}
Expand description
This trait should be implemented by all ‘root’ widgets.
It provides the functionality required only by the main controlling widget. For the trait
required for general rendering to terminal, see Widget
.
Required Associated Types
sourcetype ValidateErr: Widget
type ValidateErr: Widget
The error type returned by validate. It can be any widget and the render cycle is guaranteed to be called only once.
The output type returned by Input::run
Required Methods
The value to return from Input::run
. This will only be called once validation returns
Validation::Finish
Provided Methods
sourcefn validate(&mut self) -> Result<Validation, Self::ValidateErr>
fn validate(&mut self) -> Result<Validation, Self::ValidateErr>
Determine whether the prompt state is ready to be submitted. It is called whenever the user presses the enter key.
See Validation