icydb_base/types/
geo.rs

1use crate::prelude::*;
2
3///
4/// AddressLine
5///
6/// - Trim
7/// - Length: 1–100
8/// - Allowed: letters, digits, spaces, commas, periods, hyphens, apostrophes, TODO
9///
10
11#[newtype(
12    primitive = "Text",
13    item(prim = "Text"),
14    ty(
15        sanitizer(path = "sanitizer::text::Trim"),
16        validator(path = "validator::len::Range", args(1, 100)),
17    )
18)]
19pub struct AddressLine {}
20
21///
22/// CityName
23///
24/// - Trim
25/// - TitleCase (optional, e.g. “new york” → “New York”)
26/// - Length: 1–100
27/// - Allowed: letters, spaces, apostrophes, hyphens
28///
29
30#[newtype(
31    primitive = "Text",
32    item(prim = "Text"),
33    ty(
34        sanitizer(path = "sanitizer::text::Trim"),
35        sanitizer(path = "sanitizer::text::case::Title"),
36        validator(path = "validator::len::Range", args(1, 100)),
37    )
38)]
39pub struct CityName {}
40
41///
42/// PostalCode
43///
44/// - Trim whitespace
45/// - Uppercase
46/// - Length: 3–12 chars
47/// - Allowed: letters, digits, space, dash  TODO
48///
49
50#[newtype(
51    primitive = "Text",
52    item(prim = "Text"),
53    ty(
54        sanitizer(path = "sanitizer::text::Trim"),
55        sanitizer(path = "sanitizer::text::case::Upper"),
56        validator(path = "validator::len::Range", args(3, 12)),
57    )
58)]
59pub struct PostalCode {}
60
61///
62/// RegionName
63/// (state/province)
64///
65/// - Trim
66/// - Uppercase
67/// - Length: 2–50
68/// - Allowed: letters, spaces, hyphens  TODO
69///
70
71#[newtype(
72    primitive = "Text",
73    item(prim = "Text"),
74    ty(
75        sanitizer(path = "sanitizer::text::Trim"),
76        sanitizer(path = "sanitizer::text::case::Upper"),
77        validator(path = "validator::len::Range", args(2, 50)),
78    )
79)]
80pub struct RegionName {}