Struct tty_form::step::CompoundStep
source · pub struct CompoundStep { /* private fields */ }Expand description
A single-line step which controls multple controls including static and input elements.
Examples
use tty_form::{
Form,
step::{Step, CompoundStep},
control::{Control, StaticText, TextInput},
};
let mut form = Form::new();
let mut step = CompoundStep::new();
StaticText::new("Welcome, ").add_to(&mut step);
TextInput::new("Enter your name:", false).add_to(&mut step);
step.add_to(&mut form);Implementations
sourceimpl CompoundStep
impl CompoundStep
sourcepub fn add_control(&mut self, control: Box<dyn Control>)
pub fn add_control(&mut self, control: Box<dyn Control>)
Append the specified control to this step.
sourcepub fn set_max_line_length(&mut self, max_length: u16)
pub fn set_max_line_length(&mut self, max_length: u16)
Set this step’s maximum total line length.
Trait Implementations
sourceimpl Step for CompoundStep
impl Step for CompoundStep
sourcefn initialize(&mut self, dependency_state: &mut DependencyState, index: usize)
fn initialize(&mut self, dependency_state: &mut DependencyState, index: usize)
Perform any post-configuration initialization actions for this step.
sourcefn render(
&self,
interface: &mut Interface<'_>,
dependency_state: &DependencyState,
position: Position,
is_focused: bool
) -> u16
fn render(
&self,
interface: &mut Interface<'_>,
dependency_state: &DependencyState,
position: Position,
is_focused: bool
) -> u16
Render this step at the specified position and return the height of the rendered content.
sourcefn update(
&mut self,
dependency_state: &mut DependencyState,
input: KeyEvent
) -> Option<InputResult>
fn update(
&mut self,
dependency_state: &mut DependencyState,
input: KeyEvent
) -> Option<InputResult>
Handle the specified input event, optionally returning an instruction for the form.
sourcefn drawer(&self) -> Option<DrawerContents>
fn drawer(&self) -> Option<DrawerContents>
Retrieve this step’s current drawer contents, if applicable.
sourcefn result(&self, dependency_state: &DependencyState) -> String
fn result(&self, dependency_state: &DependencyState) -> String
Retrieves this step’s final WYSIWYG result.
Auto Trait Implementations
impl !RefUnwindSafe for CompoundStep
impl !Send for CompoundStep
impl !Sync for CompoundStep
impl Unpin for CompoundStep
impl !UnwindSafe for CompoundStep
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