pub struct Input { /* private fields */ }Expand description
The input buffer with cursor support.
Example:
use tui_input::Input;
let value = "Hello World".to_string();
let input = Input::default().with_value(value);
assert_eq!(input.value(), "Hello World");
assert_eq!(input.cursor(), 11);Implementations
sourceimpl Input
impl Input
sourcepub fn with_value(self, value: String) -> Self
pub fn with_value(self, value: String) -> Self
Set the value manually. Cursor will be set to the given value’s length.
sourcepub fn with_cursor(self, cursor: usize) -> Self
pub fn with_cursor(self, cursor: usize) -> Self
Set the cursor manually. If the input is larger than the value length, it’ll be auto adjusted.
sourcepub fn handle(&mut self, req: InputRequest) -> InputResponse
pub fn handle(&mut self, req: InputRequest) -> InputResponse
Handle request and emit response.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more