pub struct FieldMeta {
pub label: String,
pub required: bool,
pub error: Option<String>,
pub placeholder: Option<String>,
}Expand description
Metadata shared by every field variant. Holds the label, required-marker, the most recent validator error, and an optional placeholder shown when text fields are empty.
Fields§
§label: String§required: bool§error: Option<String>§placeholder: Option<String>Implementations§
Source§impl FieldMeta
impl FieldMeta
Sourcepub fn new(label: impl Into<String>) -> Self
pub fn new(label: impl Into<String>) -> Self
Construct a field with just a label. Use the builder methods to
layer on required, placeholder, etc.
Sourcepub fn required(self, required: bool) -> Self
pub fn required(self, required: bool) -> Self
Mark the field as required (renderers prefix the label with *).
Sourcepub fn placeholder(self, text: impl Into<String>) -> Self
pub fn placeholder(self, text: impl Into<String>) -> Self
Set the placeholder text shown when the field is empty and not being edited.
Auto Trait Implementations§
impl Freeze for FieldMeta
impl RefUnwindSafe for FieldMeta
impl Send for FieldMeta
impl Sync for FieldMeta
impl Unpin for FieldMeta
impl UnsafeUnpin for FieldMeta
impl UnwindSafe for FieldMeta
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