konduto/types/vehicle/
model.rs1use nutype::nutype;
2use crate::types::validation_errors::ValidationError;
3
4#[nutype(
10 sanitize(trim),
11 validate(not_empty, len_char_max = 100),
12 derive(
13 Debug,
14 Clone,
15 PartialEq,
16 Eq,
17 Display,
18 AsRef,
19 Deref,
20 Serialize,
21 Deserialize,
22 )
23)]
24pub struct VehicleModel(String);
25
26impl VehicleModel {
27 pub fn as_str(&self) -> &str {
28 self.as_ref()
29 }
30}
31
32impl From<VehicleModelError> for ValidationError {
33 fn from(err: VehicleModelError) -> Self {
34 ValidationError::Generic(err.to_string())
35 }
36}
37