pub struct TextInput { /* private fields */ }Expand description
A single-line text field input. May be used as an evaluation for dependent form elements.
Examples
use tty_form::{
step::CompoundStep,
control::{Control, TextInput},
};
let mut step = CompoundStep::new();
TextInput::new("Enter your name:", false).add_to(&mut step);Implementations
sourceimpl TextInput
impl TextInput
sourcepub fn new(prompt: &str, force_lowercase: bool) -> Self
pub fn new(prompt: &str, force_lowercase: bool) -> Self
Create a new text input control with the specified prompt and casing-rules.
sourcepub fn set_prompt(&mut self, prompt: &str)
pub fn set_prompt(&mut self, prompt: &str)
Update this input’s prompt text.
sourcepub fn set_force_lowercase(&mut self, force: bool)
pub fn set_force_lowercase(&mut self, force: bool)
Specify whether this input should force its value to be lowercase.
sourcepub fn set_evaluation(&mut self, evaluation: Evaluation) -> DependencyId
pub fn set_evaluation(&mut self, evaluation: Evaluation) -> DependencyId
Sets the dependency evaluation which other form elements can react to.
Trait Implementations
sourceimpl Control for TextInput
impl Control for TextInput
sourcefn text(&self) -> (Segment, Option<u16>)
fn text(&self) -> (Segment, Option<u16>)
This control’s rendered contents and an optional offset for the cursor.
sourcefn drawer(&self) -> Option<DrawerContents>
fn drawer(&self) -> Option<DrawerContents>
This control’s drawer contents, if available.
sourcefn evaluation(&self) -> Option<(DependencyId, Evaluation)>
fn evaluation(&self) -> Option<(DependencyId, Evaluation)>
This control’s dependency evaluation which other controls may react to.
sourcefn dependency(&self) -> Option<(DependencyId, Action)>
fn dependency(&self) -> Option<(DependencyId, Action)>
This control’s dependency which it may react to.
sourcefn evaluate(&self, evaluation: &Evaluation) -> bool
fn evaluate(&self, evaluation: &Evaluation) -> bool
Perform an evaluation against this control’s current state.
sourcefn add_to(self, step: &mut CompoundStep)
fn add_to(self, step: &mut CompoundStep)
Finish configuration and add this control to the specified form step.
Auto Trait Implementations
impl RefUnwindSafe for TextInput
impl Send for TextInput
impl Sync for TextInput
impl Unpin for TextInput
impl UnwindSafe for TextInput
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more