pub struct TextboxState {
pub cursor_pos: usize,
pub text: String,
pub hint_text: Option<String>,
/* private fields */
}
Fields§
§cursor_pos: usize
§text: String
§hint_text: Option<String>
Implementations§
Source§impl TextboxState
impl TextboxState
Sourcepub fn handle_events(&mut self, key_code: KeyCode, key_modifiers: KeyModifiers)
pub fn handle_events(&mut self, key_code: KeyCode, key_modifiers: KeyModifiers)
Examples found in repository?
examples/demo.rs (line 53)
47 fn handle_events(&mut self, key: KeyEvent) -> std::io::Result<bool> {
48 match (key.code, key.modifiers) {
49 (KeyCode::Esc, _) => return Ok(true),
50 (KeyCode::Tab, _) => { self.focused_textbox = (self.focused_textbox + 1) % 2; },
51 (key_code, key_modifiers) => {
52 match self.focused_textbox {
53 0 => self.textbox_state.handle_events(key_code, key_modifiers),
54 1 => self.textbox2_state.handle_events(key_code, key_modifiers),
55 _ => {}
56 };
57 }
58 }
59 Ok(false)
60 }
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextboxState
impl RefUnwindSafe for TextboxState
impl Send for TextboxState
impl Sync for TextboxState
impl Unpin for TextboxState
impl UnwindSafe for TextboxState
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more