pub struct InputField { /* private fields */ }Expand description
Represents a user input field.
Implementations§
Source§impl InputField
impl InputField
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new InputField.
Creates a new hidden InputField.
Sourcepub fn create<'c, C: Into<Cow<'c, str>>>(title: C) -> Self
pub fn create<'c, C: Into<Cow<'c, str>>>(title: C) -> Self
Creates a new InputField with the provided title.
Creates a new InputField with the provided title.
Sourcepub fn cursor_position(&self, index: usize) -> Position
pub fn cursor_position(&self, index: usize) -> Position
Gets the cursor position of the input field, based on it’s index in a list.
Sourcepub async fn run(
&mut self,
terminal: &mut DefaultTerminal,
events: &mut EventHandler,
) -> Result<String>
pub async fn run( &mut self, terminal: &mut DefaultTerminal, events: &mut EventHandler, ) -> Result<String>
Runs an event loop for the InputField.
Sourcepub fn as_widget(&self) -> Paragraph<'_>
pub fn as_widget(&self) -> Paragraph<'_>
Converts the InputField into a TUI widget.
Sourcepub fn constraint(&self) -> Constraint
pub fn constraint(&self) -> Constraint
Gets the layout constraint required to render the InputField.
Source§impl InputField
impl InputField
Sourcepub fn input(&self) -> &str
pub fn input(&self) -> &str
Gets the InputField input.
Sourcepub fn with_input<'a, C: Into<Cow<'a, str>>>(self, val: C) -> Self
pub fn with_input<'a, C: Into<Cow<'a, str>>>(self, val: C) -> Self
Builder function that sets the InputField input.
Sourcepub fn title(&self) -> &str
pub fn title(&self) -> &str
Gets the InputField title.
Sourcepub fn with_title<'a, C: Into<Cow<'a, str>>>(self, val: C) -> Self
pub fn with_title<'a, C: Into<Cow<'a, str>>>(self, val: C) -> Self
Builder function that sets the InputField title.
Source§impl InputField
impl InputField
Sourcepub fn state(&self) -> &InputState
pub fn state(&self) -> &InputState
Gets the InputField state.
Sourcepub fn set_state(&mut self, val: InputState)
pub fn set_state(&mut self, val: InputState)
Sets the InputField state.
Sourcepub fn with_state(self, val: InputState) -> Self
pub fn with_state(self, val: InputState) -> Self
Builder function that sets the InputField state.
Trait Implementations§
Source§impl Clone for InputField
impl Clone for InputField
Source§fn clone(&self) -> InputField
fn clone(&self) -> InputField
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 InputField
impl Debug for InputField
Source§impl Default for InputField
impl Default for InputField
Source§impl PartialEq for InputField
impl PartialEq for InputField
Source§impl Widget for &InputField
impl Widget for &InputField
Source§impl Zeroize for InputField
impl Zeroize for InputField
impl Eq for InputField
impl StructuralPartialEq for InputField
Auto Trait Implementations§
impl Freeze for InputField
impl RefUnwindSafe for InputField
impl Send for InputField
impl Sync for InputField
impl Unpin for InputField
impl UnsafeUnpin for InputField
impl UnwindSafe for InputField
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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