pub struct DateInputField<State: 'static> { /* private fields */ }Expand description
A declarative date input field. See the module docs.
Implementations§
Source§impl<State: 'static> DateInputField<State>
impl<State: 'static> DateInputField<State>
Sourcepub fn strings(self, strings: DatePickerStrings) -> Self
pub fn strings(self, strings: DatePickerStrings) -> Self
Replace the localized strings (default DatePickerStrings::ENGLISH).
Sourcepub fn selectable<F: Fn(MaterialDate) -> bool + 'static>(
self,
predicate: F,
) -> Self
pub fn selectable<F: Fn(MaterialDate) -> bool + 'static>( self, predicate: F, ) -> Self
Refuse individual dates inside the bounds — the reference’s
selectableDayPredicate, reported as DateInputError::OutOfRange.
Sourcepub fn validate(self, validate: bool) -> Self
pub fn validate(self, validate: bool) -> Self
Whether the field shows its error while typing (default true). false
is the reference’s deferred AutovalidateMode.disabled shape — see the
module docs.
Sourcepub fn parse(&self, text: &str) -> Result<MaterialDate, DateInputError>
pub fn parse(&self, text: &str) -> Result<MaterialDate, DateInputError>
Parse text against this field’s bounds and its predicate.
Sourcepub fn error(&self) -> Option<&'static str>
pub fn error(&self) -> Option<&'static str>
The error string this field currently shows, if any: None for an empty
field, for a valid date, or when Self::validate is off.
Sourcepub fn next_state(&self, text: &str) -> DatePickerState
pub fn next_state(&self, text: &str) -> DatePickerState
The state typing text into this field requests: the draft text
recorded always, and the selection updated too whenever text resolves
to a selectable date.
The draft text is re-applied after the selection so the user’s own
keystrokes survive — DatePickerState::with_selected would otherwise
reformat the field out from under them.
Trait Implementations§
Source§impl<State: 'static> View<State> for DateInputField<State>
impl<State: 'static> View<State> for DateInputField<State>
Source§type Element = TextFieldWidget
type Element = TextFieldWidget
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> TextFieldWidget
fn build(&self, ctx: &mut BuildCtx<'_>) -> TextFieldWidget
Source§fn rebuild(
&self,
prev: &Self,
element: &mut TextFieldWidget,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &Self, element: &mut TextFieldWidget, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl<State> !RefUnwindSafe for DateInputField<State>
impl<State> !Send for DateInputField<State>
impl<State> !Sync for DateInputField<State>
impl<State> !UnwindSafe for DateInputField<State>
impl<State> Freeze for DateInputField<State>
impl<State> Unpin for DateInputField<State>
impl<State> UnsafeUnpin for DateInputField<State>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.