pub trait RequiredField {
// Required method
fn validate_required(&self) -> Vec<&'static str>;
}Expand description
标识某个字段是否是必填的。
对应 Java @Required。在 Rust 中该注解的语义由使用方通过校验函数实现
(如构造/反序列化后的校验),不引入运行时反射。
Required Methods§
Sourcefn validate_required(&self) -> Vec<&'static str>
fn validate_required(&self) -> Vec<&'static str>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".