pub struct InputFieldState { /* private fields */ }Expand description
State for an InputField component.
Implementations§
Source§impl InputFieldState
impl InputFieldState
Sourcepub fn with_value(value: impl Into<String>) -> Self
pub fn with_value(value: impl Into<String>) -> Self
Creates a new state with the given initial value.
Sourcepub fn with_placeholder(placeholder: impl Into<String>) -> Self
pub fn with_placeholder(placeholder: impl Into<String>) -> Self
Creates a new state with placeholder text.
Sourcepub fn set_value(&mut self, value: impl Into<String>)
pub fn set_value(&mut self, value: impl Into<String>)
Sets the value and moves cursor to the end.
Sourcepub fn cursor_position(&self) -> usize
pub fn cursor_position(&self) -> usize
Returns the cursor position (character index).
Sourcepub fn cursor_byte_offset(&self) -> usize
pub fn cursor_byte_offset(&self) -> usize
Returns the cursor byte offset.
Sourcepub fn set_placeholder(&mut self, placeholder: impl Into<String>)
pub fn set_placeholder(&mut self, placeholder: impl Into<String>)
Sets the placeholder text.
Sourcepub fn placeholder(&self) -> &str
pub fn placeholder(&self) -> &str
Returns the placeholder text.
Sourcepub fn set_cursor(&mut self, char_pos: usize)
pub fn set_cursor(&mut self, char_pos: usize)
Moves cursor to the given character position.
Trait Implementations§
Source§impl Clone for InputFieldState
impl Clone for InputFieldState
Source§fn clone(&self) -> InputFieldState
fn clone(&self) -> InputFieldState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InputFieldState
impl Debug for InputFieldState
Source§impl Default for InputFieldState
impl Default for InputFieldState
Source§fn default() -> InputFieldState
fn default() -> InputFieldState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InputFieldState
impl RefUnwindSafe for InputFieldState
impl Send for InputFieldState
impl Sync for InputFieldState
impl Unpin for InputFieldState
impl UnwindSafe for InputFieldState
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> 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