konduto/types/events/event_name.rs
1use crate::impl_nutype_error_conversion;
2use nutype::nutype;
3
4/// Nome do evento (máximo 255 caracteres)
5///
6/// # Validações
7/// - Não pode ser vazio (após trim)
8/// - Máximo 255 caracteres
9#[nutype(
10 sanitize(trim),
11 validate(not_empty, len_char_max = 255),
12 derive(
13 Debug,
14 Clone,
15 PartialEq,
16 Eq,
17 Display,
18 AsRef,
19 Deref,
20 Serialize,
21 Deserialize,
22 )
23)]
24pub struct EventName(String);
25
26impl EventName {
27 pub fn as_str(&self) -> &str {
28 self.as_ref()
29 }
30}
31
32impl_nutype_error_conversion!(EventNameError);
33