Skip to main content

DurationField

Struct DurationField 

Source
pub struct DurationField {
    pub base: FieldConfig,
    pub min_seconds: Option<u64>,
    pub max_seconds: Option<u64>,
}
Expand description

Duration input stored as seconds (u64). Optional min/max bounds in seconds.

Fields§

§base: FieldConfig§min_seconds: Option<u64>§max_seconds: Option<u64>

Implementations§

Source§

impl DurationField

Source

pub fn new(name: &str) -> Self

Creates a duration field.

Source

pub fn min_seconds(self, seconds: u64, msg: &str) -> Self

Minimum duration in seconds. msg overrides the default error (pass "" for default).

Source

pub fn max_seconds(self, seconds: u64, msg: &str) -> Self

Maximum duration in seconds. msg overrides the default error (pass "" for default).

Source

pub fn label(self, label: &str) -> Self

Overrides the auto-generated label.

Source

pub fn required(self) -> Self

Marks the field as required (empty value fails validation).

Trait Implementations§

Source§

impl Clone for DurationField

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CommonFieldConfig for DurationField

Source§

fn get_field_config(&self) -> &FieldConfig

Source§

fn get_field_config_mut(&mut self) -> &mut FieldConfig

Source§

fn is_password(&self) -> bool

true if the field’s value must never be exposed. Read more
Source§

impl Debug for DurationField

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FormField for DurationField

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,

Field-type specific validation
Source§

fn render(&self, tera: &ATera) -> Result<String, String>

HTML rendering of the field
Source§

fn name(&self) -> &str

Source§

fn label(&self) -> &str

Source§

fn value(&self) -> &str

Source§

fn placeholder(&self) -> &str

Source§

fn field_type(&self) -> &str

Source§

fn template_name(&self) -> &str

Source§

fn error(&self) -> Option<&String>

Source§

fn required(&self) -> bool

Source§

fn set_name(&mut self, name: &str)

Source§

fn set_label(&mut self, label: &str)

Source§

fn set_value(&mut self, value: &str)

Source§

fn set_placeholder(&mut self, placeholder: &str)

Source§

fn set_error(&mut self, message: String)

Source§

fn clear_error(&mut self)

Resets the field error (explicit equivalent of set_error(""))
Source§

fn set_required(&mut self, required: bool, msg: Option<&str>)

Source§

fn set_html_attribute(&mut self, key: &str, value: &str)

Source§

fn set_readonly(&mut self, readonly: bool, msg: Option<&str>)

Source§

fn set_disabled(&mut self, disabled: bool, msg: Option<&str>)

Source§

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

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

The lengths or values this field accepts; none by default.
Source§

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>

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>

Overrides the effective max_size. Returns Err if it exceeds the model ceiling.
Source§

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,

Finalization (e.g., password hashing)
Source§

fn to_json_value(&self) -> Value

Source§

fn to_json_required(&self) -> Value

Source§

fn to_json_readonly(&self) -> Value

Source§

fn to_json_disabled(&self) -> Value

Source§

fn to_json_attributes(&self) -> Value

Source§

fn to_json_meta(&self) -> Value

Source§

impl From<DurationField> for GenericField

Source§

fn from(f: DurationField) -> Self

Converts to this type from the input type.
Source§

impl Serialize for DurationField

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<F, T> ConvertInto<T> for F
where T: ConvertFrom<F>,

Source§

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 T
where F: ConvertInto<T>,

Source§

type Error = !

The type of an error that can occur during a conversion. Read more
Source§

fn convert_try_from(value: F) -> Result<T, !>

Fallibly converts a value of type F to a value of type Self.
Source§

impl<F, T> ConvertTryInto<T> for F
where T: ConvertTryFrom<F>,

Source§

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>

Fallibly converts a value of type Self to a value of type T.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ServiceExt for T

Source§

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,

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,

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,

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,

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,

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,

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,

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,

Insert a header into the response, if the header is not already present. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more