Trait form_checker::FieldType
[−]
[src]
pub trait FieldType { fn from_str(
&self,
field_name: &str,
field_title: &str,
value: &str
) -> Result<FieldValue, Message>; }
This trait represents the field type.
We offer some field types, like Str
, I64
, ChinaMobile
and Email
.
You just need to implement this trait to transform the raw str value into a
FeildValue
.
field_name is the field name in the form.
field_title is a descriptive value, used to diplay invalid messages.
value is the raw str value from the form.
And of course you can implement your own field type!
Required Methods
fn from_str(
&self,
field_name: &str,
field_title: &str,
value: &str
) -> Result<FieldValue, Message>
&self,
field_name: &str,
field_title: &str,
value: &str
) -> Result<FieldValue, Message>
Implementors
impl FieldType for Str
impl FieldType for I64
impl FieldType for ChinaMobile
impl FieldType for Email