pub struct CommandInputState { /* private fields */ }
Implementations§
Source§impl CommandInputState
impl CommandInputState
Sourcepub fn add_char(&mut self, c: char)
pub fn add_char(&mut self, c: char)
Examples found in repository?
examples/command/main.rs (line 50)
31fn handle_input(tui: &mut TuiClap, events: &Events) {
32 if let Ok(Some(Event::Key(key_event))) = events.next() {
33 match key_event.code {
34 KeyCode::Backspace => {
35 tui.state().del_char()
36 }
37 KeyCode::Enter => {
38 if let Ok(matches) = tui.parse() {
39 match handle_matches(matches) {
40 Ok(output) => {
41 for message in output {
42 tui.write_to_output(message)
43 }
44 }
45 Err(err) => tui.write_to_output(err)
46 }
47 }
48 }
49 KeyCode::Char(char) => {
50 tui.state().add_char(char)
51 },
52 _ => {}
53 }
54 }
55}
Sourcepub fn del_char(&mut self)
pub fn del_char(&mut self)
Examples found in repository?
examples/command/main.rs (line 35)
31fn handle_input(tui: &mut TuiClap, events: &Events) {
32 if let Ok(Some(Event::Key(key_event))) = events.next() {
33 match key_event.code {
34 KeyCode::Backspace => {
35 tui.state().del_char()
36 }
37 KeyCode::Enter => {
38 if let Ok(matches) = tui.parse() {
39 match handle_matches(matches) {
40 Ok(output) => {
41 for message in output {
42 tui.write_to_output(message)
43 }
44 }
45 Err(err) => tui.write_to_output(err)
46 }
47 }
48 }
49 KeyCode::Char(char) => {
50 tui.state().add_char(char)
51 },
52 _ => {}
53 }
54 }
55}
pub fn reset(&mut self)
pub fn enter(&mut self) -> String
pub fn back_in_history(&mut self)
pub fn forward_in_history(&mut self)
Trait Implementations§
Source§impl Default for CommandInputState
impl Default for CommandInputState
Source§fn default() -> CommandInputState
fn default() -> CommandInputState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CommandInputState
impl RefUnwindSafe for CommandInputState
impl Send for CommandInputState
impl Sync for CommandInputState
impl Unpin for CommandInputState
impl UnwindSafe for CommandInputState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more