pub struct FormField {
pub name: String,
pub field_type: String,
pub label: String,
pub required: bool,
pub value: Option<String>,
pub placeholder: Option<String>,
pub selector: Option<String>,
pub options: Vec<String>,
}Expand description
A field in a form.
Fields§
§name: StringField name attribute.
field_type: StringField type (text, email, password, etc.).
label: StringField label text.
required: boolWhether the field is required.
value: Option<String>Current value.
placeholder: Option<String>Placeholder text.
selector: Option<String>CSS selector.
options: Vec<String>Options for select fields.
Implementations§
Source§impl FormField
impl FormField
Sourcepub fn new(name: impl Into<String>, field_type: impl Into<String>) -> FormField
pub fn new(name: impl Into<String>, field_type: impl Into<String>) -> FormField
Create a new form field.
Sourcepub fn with_label(self, label: impl Into<String>) -> FormField
pub fn with_label(self, label: impl Into<String>) -> FormField
Set label.
Sourcepub fn with_selector(self, selector: impl Into<String>) -> FormField
pub fn with_selector(self, selector: impl Into<String>) -> FormField
Set selector.
Sourcepub fn with_value(self, value: impl Into<String>) -> FormField
pub fn with_value(self, value: impl Into<String>) -> FormField
Set current value.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FormField
impl<'de> Deserialize<'de> for FormField
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FormField, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FormField, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for FormField
impl Serialize for FormField
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for FormField
impl RefUnwindSafe for FormField
impl Send for FormField
impl Sync for FormField
impl Unpin for FormField
impl UnsafeUnpin for FormField
impl UnwindSafe for FormField
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