pub trait Datatype:
Clone
+ Display
+ Debug
+ Default
+ FromStr<Err = Self::Error>
+ Into<Self::Inner>
+ PartialEq
+ 'static {
type Inner: Datatype;
type Error: From<<Self::Inner as Datatype>::Error> + Error + Clone + PartialEq + 'static;
// Required methods
fn validate(input: Self::Inner) -> Result<Self, Self::Error>
where Self: Sized;
fn attributes() -> Vec<(&'static str, Attribute)>;
}
Expand description
A trait for defining custom datatypes. Implemented on all types that can be used as a form input.
Required Associated Types§
type Inner: Datatype
type Error: From<<Self::Inner as Datatype>::Error> + Error + Clone + PartialEq + 'static
Required Methods§
Sourcefn validate(input: Self::Inner) -> Result<Self, Self::Error>where
Self: Sized,
fn validate(input: Self::Inner) -> Result<Self, Self::Error>where
Self: Sized,
Validate the input and return the datatype.
Sourcefn attributes() -> Vec<(&'static str, Attribute)>
fn attributes() -> Vec<(&'static str, Attribute)>
Return the HTML attributes for the datatype that should be added to an input field.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.