pub struct Input { /* private fields */ }Expand description
Holds the chars typed by the user and the cursor position. Methods allow mutation of this content and movement of the cursor.
Implementations§
Source§impl Input
impl Input
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn cursor_start(&mut self)
pub fn cursor_start(&mut self)
Move the cursor to the start
Sourcepub fn cursor_end(&mut self)
pub fn cursor_end(&mut self)
Move the cursor to the end
Sourcepub fn cursor_left(&mut self)
pub fn cursor_left(&mut self)
Move the cursor left if possible
Sourcepub fn cursor_right(&mut self)
pub fn cursor_right(&mut self)
Move the cursor right if possible
Sourcepub fn cursor_move(&mut self, index: usize)
pub fn cursor_move(&mut self, index: usize)
Move the cursor to the given index, limited to the length of the input.
Used when the user click on the input string.
Sourcepub fn delete_char_left(&mut self)
pub fn delete_char_left(&mut self)
Backspace, delete the char under the cursor and move left
Sourcepub fn delete_chars_right(&mut self)
pub fn delete_chars_right(&mut self)
Delete all chars right to the cursor
pub fn delete_line(&mut self)
Sourcepub fn delete_left(&mut self)
pub fn delete_left(&mut self)
Deletes left symbols until a separator is reached or the start of the line
Sourcepub fn replace(&mut self, content: &str)
pub fn replace(&mut self, content: &str)
Replace the content with the new content. Put the cursor at the end.
To avoid splitting graphemes at wrong place, the new content is read as Unicode Graphemes with
unicode_segmentation::UnicodeSegmentation::graphemes(content, true)See UnicodeSegmentation for more information.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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