pub struct CharInput<F = FilterMapChar> { /* private fields */ }
Expand description
A widget that inputs a single character.
A filter_map
function can optionally be provided to limit and change the characters allowed,
similar to Iterator::filter_map
.
If multiple characters are received, they will overwrite the previous character. If a
multi-character string is required, use StringInput
.
Implementations§
Source§impl<F> CharInput<F>
impl<F> CharInput<F>
Sourcepub fn with_filter_map(filter_map: F) -> Self
pub fn with_filter_map(filter_map: F) -> Self
Creates a new CharInput
which only accepts characters as per the filter_map
function.
Sourcepub fn clear_value(&mut self)
pub fn clear_value(&mut self)
Clears the value.
Trait Implementations§
Source§impl<F> Widget for CharInput<F>
impl<F> Widget for CharInput<F>
Source§fn cursor_pos(&mut self, layout: Layout) -> (u16, u16)
fn cursor_pos(&mut self, layout: Layout) -> (u16, u16)
Returns the position right after the character if any.
Source§fn handle_key(&mut self, key: KeyEvent) -> bool
fn handle_key(&mut self, key: KeyEvent) -> bool
Handle a key input. It should return whether key was handled.
Auto Trait Implementations§
impl<F> Freeze for CharInput<F>where
F: Freeze,
impl<F> RefUnwindSafe for CharInput<F>where
F: RefUnwindSafe,
impl<F> Send for CharInput<F>where
F: Send,
impl<F> Sync for CharInput<F>where
F: Sync,
impl<F> Unpin for CharInput<F>where
F: Unpin,
impl<F> UnwindSafe for CharInput<F>where
F: UnwindSafe,
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