1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
use crate::unicode::ucd::property_names;
#[derive(Clone, Copy)]
pub struct PropertyName {
pub full: &'static str,
pub abbr: &'static str,
}
pub trait UnicodeProperty {
fn property_value_name(&self) -> PropertyName;
}
#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum BinaryProperty {
Y,
N,
}
impl From<bool> for BinaryProperty {
fn from(val: bool) -> Self {
match val {
true => BinaryProperty::Y,
false => BinaryProperty::N,
}
}
}
impl UnicodeProperty for BinaryProperty {
fn property_value_name(&self) -> PropertyName {
property_names::binary_property_name(*self)
}
}
#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum Gc {
Cc,
Cf,
Cn,
Co,
Cs,
Ll,
Lm,
Lo,
Lt,
Lu,
Mc,
Me,
Mn,
Nd,
Nl,
No,
Pc,
Pd,
Pe,
Pf,
Pi,
Po,
Ps,
Sc,
Sk,
Sm,
So,
Zl,
Zp,
Zs,
}
impl UnicodeProperty for Gc {
fn property_value_name(&self) -> PropertyName {
property_names::gc_name(*self)
}
}
#[derive(Debug, PartialEq, Clone, Copy)]
#[repr(u8)]
pub enum Hst {
L,
LV,
LVT,
NA,
T,
V,
}
impl UnicodeProperty for Hst {
fn property_value_name(&self) -> PropertyName {
property_names::hst_name(*self)
}
}