Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 375 Bytes

rfcs2.md

File metadata and controls

34 lines (28 loc) · 375 Bytes

a model:

struct Data {
  name: String,
  email: String,
  password: String,
  age: u8,
  weight: f32,
}

valitron!{
  Data{
    name: Required,
    email: Required.and(Trim),
    password: custom(handle)
  }
}
message!{
  Data{
    name.required => "name is required",
  }
}


// finaly code: 

impl Data {
   fn validate(&self) -> bool {
      self.name
   }
}