konduto/types/events/
event_subtype.rs

1use crate::impl_nutype_error_conversion;
2use nutype::nutype;
3
4/// Subtipo do evento (máximo 100 caracteres)
5///
6/// # Validações
7/// - Não pode ser vazio (após trim)
8/// - Máximo 100 caracteres
9#[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 EventSubtype(String);
25
26impl EventSubtype {
27    pub fn as_str(&self) -> &str {
28        self.as_ref()
29    }
30}
31
32impl_nutype_error_conversion!(EventSubtypeError);
33