pub struct TypedInput<'a, T, Message, Theme = Theme, Renderer = Renderer>{ /* private fields */ }Expand description
Implementations§
Source§impl<'a, T, Message, Theme, Renderer> TypedInput<'a, T, Message, Theme, Renderer>
impl<'a, T, Message, Theme, Renderer> TypedInput<'a, T, Message, Theme, Renderer>
Sourcepub fn new(placeholder: &str, value: &T) -> Selfwhere
T: 'a + Clone,
pub fn new(placeholder: &str, value: &T) -> Selfwhere
T: 'a + Clone,
Creates a new TypedInput.
It expects:
- the current value
- a function that produces a message when the
TypedInputchanges
Sourcepub fn secure(self, is_secure: bool) -> Self
pub fn secure(self, is_secure: bool) -> Self
Convert the TypedInput into a secure password input
Sourcepub fn on_input<F>(self, callback: F) -> Selfwhere
F: 'a + Fn(T) -> Message,
pub fn on_input<F>(self, callback: F) -> Selfwhere
F: 'a + Fn(T) -> Message,
Sets the message that should be produced when some valid text is typed into TypedInput
If neither this method nor on_submit is called, the TypedInput will be disabled
Sourcepub fn on_input_maybe<F>(self, callback: Option<F>) -> Selfwhere
F: 'a + Fn(T) -> Message,
pub fn on_input_maybe<F>(self, callback: Option<F>) -> Selfwhere
F: 'a + Fn(T) -> Message,
Sets the message that should be produced when some text is typed into the TypedInput, if Some.
If this is None, and there is no on_submit callback, the TypedInput will be disabled.
Sourcepub fn on_submit<F>(self, callback: F) -> Self
pub fn on_submit<F>(self, callback: F) -> Self
Sets the message that should be produced when the [TypedtInput] is
focused and the enter key is pressed.
If neither this method nor on_input is called, the TypedInput will be disabled
Sourcepub fn on_submit_maybe<F>(self, callback: Option<F>) -> Self
pub fn on_submit_maybe<F>(self, callback: Option<F>) -> Self
Sets the message that should be produced when the [TypedtInput] is
focused and the enter key is pressed, if Some.
If this is None, and there is no on_change callback, the TypedInput will be disabled.
Sourcepub fn on_paste<F>(self, callback: F) -> Selfwhere
F: 'a + Fn(T) -> Message,
pub fn on_paste<F>(self, callback: F) -> Selfwhere
F: 'a + Fn(T) -> Message,
Sets the message that should be produced when some text is pasted into the TypedInput, resulting in a valid value
Sourcepub fn on_paste_maybe<F>(self, callback: Option<F>) -> Selfwhere
F: 'a + Fn(T) -> Message,
pub fn on_paste_maybe<F>(self, callback: Option<F>) -> Selfwhere
F: 'a + Fn(T) -> Message,
Sets the message that should be produced when some text is pasted into the TypedInput, resulting in a valid value, if Some
Sourcepub fn font(self, font: Renderer::Font) -> Self
pub fn font(self, font: Renderer::Font) -> Self
Sets the Font of the TypedInput.
Sourcepub fn width(self, width: impl Into<Length>) -> Self
pub fn width(self, width: impl Into<Length>) -> Self
Sets the width of the TypedInput.
Sourcepub fn padding(self, padding: impl Into<Padding>) -> Self
pub fn padding(self, padding: impl Into<Padding>) -> Self
Sets the padding of the TypedInput.
Sourcepub fn size(self, size: impl Into<Pixels>) -> Self
pub fn size(self, size: impl Into<Pixels>) -> Self
Sets the text size of the TypedInput.
Sourcepub fn line_height(self, line_height: impl Into<LineHeight>) -> Self
pub fn line_height(self, line_height: impl Into<LineHeight>) -> Self
Sets the text::LineHeight of the TypedInput.
Sourcepub fn align_x(self, alignment: impl Into<Horizontal>) -> Self
pub fn align_x(self, alignment: impl Into<Horizontal>) -> Self
Sets the horizontal alignment of the TypedInput.
Sourcepub fn style(self, style: impl Fn(&Theme, Status) -> Style + 'a) -> Self
pub fn style(self, style: impl Fn(&Theme, Status) -> Style + 'a) -> Self
Sets the style of the input of the TypedInput.
Sourcepub fn class(self, class: impl Into<<Theme as Catalog>::Class<'a>>) -> Self
pub fn class(self, class: impl Into<<Theme as Catalog>::Class<'a>>) -> Self
Sets the class of the input of the TypedInput.
Sourcepub fn text(&self) -> &str
pub fn text(&self) -> &str
Gets the current text of the TypedInput.
Trait Implementations§
Source§impl<'a, T, Message, Theme, Renderer> From<TypedInput<'a, T, Message, Theme, Renderer>> for Element<'a, Message, Theme, Renderer>
impl<'a, T, Message, Theme, Renderer> From<TypedInput<'a, T, Message, Theme, Renderer>> for Element<'a, Message, Theme, Renderer>
Source§fn from(typed_input: TypedInput<'a, T, Message, Theme, Renderer>) -> Self
fn from(typed_input: TypedInput<'a, T, Message, Theme, Renderer>) -> Self
Source§impl<'a, T, Message, Theme, Renderer> Widget<Message, Theme, Renderer> for TypedInput<'a, T, Message, Theme, Renderer>
impl<'a, T, Message, Theme, Renderer> Widget<Message, Theme, Renderer> for TypedInput<'a, T, Message, Theme, Renderer>
Source§fn draw(
&self,
state: &Tree,
renderer: &mut Renderer,
theme: &Theme,
style: &Style,
layout: Layout<'_>,
cursor: Cursor,
viewport: &Rectangle,
)
fn draw( &self, state: &Tree, renderer: &mut Renderer, theme: &Theme, style: &Style, layout: Layout<'_>, cursor: Cursor, viewport: &Rectangle, )
Widget using the associated Renderer.Source§fn mouse_interaction(
&self,
state: &Tree,
layout: Layout<'_>,
cursor: Cursor,
viewport: &Rectangle,
renderer: &Renderer,
) -> Interaction
fn mouse_interaction( &self, state: &Tree, layout: Layout<'_>, cursor: Cursor, viewport: &Rectangle, renderer: &Renderer, ) -> Interaction
Source§fn operate(
&mut self,
state: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<()>,
)
fn operate( &mut self, state: &mut Tree, layout: Layout<'_>, renderer: &Renderer, operation: &mut dyn Operation<()>, )
Auto Trait Implementations§
impl<'a, T, Message, Theme, Renderer> Freeze for TypedInput<'a, T, Message, Theme, Renderer>
impl<'a, T, Message, Theme = Theme, Renderer = Renderer<Renderer, Renderer>> !RefUnwindSafe for TypedInput<'a, T, Message, Theme, Renderer>
impl<'a, T, Message, Theme = Theme, Renderer = Renderer<Renderer, Renderer>> !Send for TypedInput<'a, T, Message, Theme, Renderer>
impl<'a, T, Message, Theme = Theme, Renderer = Renderer<Renderer, Renderer>> !Sync for TypedInput<'a, T, Message, Theme, Renderer>
impl<'a, T, Message, Theme, Renderer> Unpin for TypedInput<'a, T, Message, Theme, Renderer>
impl<'a, T, Message, Theme = Theme, Renderer = Renderer<Renderer, Renderer>> !UnwindSafe for TypedInput<'a, T, Message, Theme, Renderer>
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
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>
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>
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)
&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)
&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> 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>
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>
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