leptos_controls_core/
field.rs

1use std::borrow::Cow;
2
3pub trait Field {
4    ///
5    /// 字段名称
6    ///
7    fn label(&self) -> &'static str;
8
9    ///
10    /// 字段是否必须
11    ///
12    fn required(&self) -> bool;
13
14    ///
15    /// 字段校验
16    ///
17    fn validate(&self) -> Option<Cow<'static, str>>;
18
19    ///
20    /// 设置默认值
21    ///
22    fn set_default(&self);
23}