pub struct RadioField {
pub base: FieldConfig,
pub choices: Vec<ChoiceOption>,
}Expand description
A group of <input type="radio"> buttons where one option can be selected.
Fields§
§base: FieldConfig§choices: Vec<ChoiceOption>Implementations§
Source§impl RadioField
impl RadioField
Sourcepub fn new(name: &str) -> Self
pub fn new(name: &str) -> Self
Creates an empty radio group. Add options with choices or add_choice.
Sourcepub fn choices(self, choices: Vec<ChoiceOption>) -> Self
pub fn choices(self, choices: Vec<ChoiceOption>) -> Self
Replaces all options at once.
Sourcepub fn add_choice(self, value: &str, label: &str) -> Self
pub fn add_choice(self, value: &str, label: &str) -> Self
Appends a single option.
Trait Implementations§
Source§impl Clone for RadioField
impl Clone for RadioField
Source§impl CommonFieldConfig for RadioField
impl CommonFieldConfig for RadioField
fn get_field_config(&self) -> &FieldConfig
fn get_field_config_mut(&mut self) -> &mut FieldConfig
Source§fn is_password(&self) -> bool
fn is_password(&self) -> bool
true if the field’s value must never be exposed. Read moreSource§impl Debug for RadioField
impl Debug for RadioField
Source§impl FormField for RadioField
impl FormField for RadioField
Source§fn validate<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn validate<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Field-type specific validation
fn to_json_value(&self) -> Value
fn to_json_required(&self) -> Value
fn to_json_attributes(&self) -> Value
fn name(&self) -> &str
fn label(&self) -> &str
fn value(&self) -> &str
fn placeholder(&self) -> &str
fn field_type(&self) -> &str
fn template_name(&self) -> &str
fn error(&self) -> Option<&String>
fn required(&self) -> bool
fn set_name(&mut self, name: &str)
fn set_label(&mut self, label: &str)
fn set_value(&mut self, value: &str)
fn set_placeholder(&mut self, placeholder: &str)
fn set_error(&mut self, message: String)
Source§fn clear_error(&mut self)
fn clear_error(&mut self)
Resets the field error (explicit equivalent of
set_error(""))fn set_required(&mut self, required: bool, msg: Option<&str>)
fn set_html_attribute(&mut self, key: &str, value: &str)
fn set_readonly(&mut self, readonly: bool, msg: Option<&str>)
fn set_disabled(&mut self, disabled: bool, msg: Option<&str>)
Source§fn set_submitted_value(&mut self, value: &str)
fn set_submitted_value(&mut self, value: &str)
Sets a value that came from the request (
Forms::fill), as opposed to
one set by code. Same as set_value unless the field has to check where
the value comes from — a file field only takes a path to a file this
request uploaded.Source§fn set_type_bounds(&mut self, _min: i128, _max: i128) -> bool
fn set_type_bounds(&mut self, _min: i128, _max: i128) -> bool
Holds an integer field to what its Rust column type can store.
false
if this isn’t an integer field.Source§fn bounds(&self) -> FieldBounds
fn bounds(&self) -> FieldBounds
The lengths or values this field accepts; none by default.
Source§fn cap_max_size(&mut self, _bytes: u64)
fn cap_max_size(&mut self, _bytes: u64)
Lowers the accepted upload size to the column’s, if the field allows more.
Source§fn model_max_size(&self) -> Option<u64>
fn model_max_size(&self) -> Option<u64>
Model-defined ceiling for max_size (file fields only). None for other field types.
Source§fn set_max_size_bounded(&mut self, _size: FileSize) -> Result<(), String>
fn set_max_size_bounded(&mut self, _size: FileSize) -> Result<(), String>
Overrides the effective max_size. Returns Err if it exceeds the model ceiling.
Source§fn base_context(&self) -> Context
fn base_context(&self) -> Context
Rendering context shared by every field. Read more
Source§fn finalize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn finalize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Finalization (e.g., password hashing)
fn to_json_readonly(&self) -> Value
fn to_json_disabled(&self) -> Value
fn to_json_meta(&self) -> Value
Source§impl From<RadioField> for GenericField
impl From<RadioField> for GenericField
Source§fn from(f: RadioField) -> Self
fn from(f: RadioField) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for RadioField
impl RefUnwindSafe for RadioField
impl Send for RadioField
impl Sync for RadioField
impl Unpin for RadioField
impl UnsafeUnpin for RadioField
impl UnwindSafe for RadioField
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
impl<F, T> ConvertInto<T> for Fwhere
T: ConvertFrom<F>,
Source§fn convert_into(self) -> T
fn convert_into(self) -> T
Infallibly converts a value of type
Self to a value of type T.Source§impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
impl<F, T> ConvertTryFrom<F> for Twhere
F: ConvertInto<T>,
Source§impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
impl<F, T> ConvertTryInto<T> for Fwhere
T: ConvertTryFrom<F>,
Source§type Error = <T as ConvertTryFrom<F>>::Error
type Error = <T as ConvertTryFrom<F>>::Error
The type of an error that can occur during a conversion. Read more
Source§fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>
fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>
Fallibly converts a value of type
Self to a value of type T.impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> 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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
Compresses response bodies. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more
Source§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Insert a header into the request. Read more
Source§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Append a header into the request. Read more
Source§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Insert a header into the request, if the header is not already present. Read more
Source§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Insert a header into the response. Read more
Source§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Append a header into the response. Read more
Source§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Insert a header into the response, if the header is not already present. Read more