Struct fiberplane_models::providers::CheckboxField
source · #[non_exhaustive]pub struct CheckboxField {
pub checked: bool,
pub label: String,
pub name: String,
pub required: bool,
pub value: String,
}Expand description
Defines a field that produces a boolean value.
For JSON/YAML encoding, the value will be represented as a native boolean.
In the case of “application/x-www-form-urlencoded”, it will be represented
by the value defined in the value field, which will be either present or
not, similar to the encoding of HTML forms.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.checked: boolWhether the checkbox should be initially checked if no query data is present.
label: StringSuggested label to display along the checkbox.
name: StringName of the field as it will be included in the encoded query or config object.
required: boolWhether the checkbox must be checked.
This allows for the use case of implementing Terms of Service checkboxes in config forms.
value: StringValue of the field as it will be included in the encoded query. Note that only checked checkboxes will be included.
If the data is encoded using either JSON or YAML, the checkbox state is encoded as a boolean and this value will not be used.
Implementations§
source§impl CheckboxField
impl CheckboxField
sourcepub fn checked_by_default(self) -> Self
pub fn checked_by_default(self) -> Self
Marks the checkbox as being checked by default.
pub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_name(self, name: impl Into<String>) -> Self
pub fn with_value(self, value: impl Into<String>) -> Self
Trait Implementations§
source§impl Clone for CheckboxField
impl Clone for CheckboxField
source§fn clone(&self) -> CheckboxField
fn clone(&self) -> CheckboxField
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for CheckboxField
impl Debug for CheckboxField
source§impl Default for CheckboxField
impl Default for CheckboxField
source§fn default() -> CheckboxField
fn default() -> CheckboxField
source§impl<'de> Deserialize<'de> for CheckboxField
impl<'de> Deserialize<'de> for CheckboxField
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<CheckboxField> for ConfigField
impl From<CheckboxField> for ConfigField
source§fn from(field: CheckboxField) -> Self
fn from(field: CheckboxField) -> Self
source§impl From<CheckboxField> for QueryField
impl From<CheckboxField> for QueryField
source§fn from(field: CheckboxField) -> Self
fn from(field: CheckboxField) -> Self
source§impl PartialEq for CheckboxField
impl PartialEq for CheckboxField
source§fn eq(&self, other: &CheckboxField) -> bool
fn eq(&self, other: &CheckboxField) -> bool
self and other values to be equal, and is used
by ==.