1 | // This file is part of ICU4X. For terms of use, please see the file |
2 | // called LICENSE at the top level of the ICU4X source tree |
3 | // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). |
4 | |
5 | #[repr (u8)] |
6 | #[allow (dead_code)] |
7 | #[derive (PartialEq, Eq, Ord, PartialOrd, Copy, Clone, Hash)] |
8 | pub enum AsciiByte { |
9 | B0 = 0, |
10 | B1 = 1, |
11 | B2 = 2, |
12 | B3 = 3, |
13 | B4 = 4, |
14 | B5 = 5, |
15 | B6 = 6, |
16 | B7 = 7, |
17 | B8 = 8, |
18 | B9 = 9, |
19 | B10 = 10, |
20 | B11 = 11, |
21 | B12 = 12, |
22 | B13 = 13, |
23 | B14 = 14, |
24 | B15 = 15, |
25 | B16 = 16, |
26 | B17 = 17, |
27 | B18 = 18, |
28 | B19 = 19, |
29 | B20 = 20, |
30 | B21 = 21, |
31 | B22 = 22, |
32 | B23 = 23, |
33 | B24 = 24, |
34 | B25 = 25, |
35 | B26 = 26, |
36 | B27 = 27, |
37 | B28 = 28, |
38 | B29 = 29, |
39 | B30 = 30, |
40 | B31 = 31, |
41 | B32 = 32, |
42 | B33 = 33, |
43 | B34 = 34, |
44 | B35 = 35, |
45 | B36 = 36, |
46 | B37 = 37, |
47 | B38 = 38, |
48 | B39 = 39, |
49 | B40 = 40, |
50 | B41 = 41, |
51 | B42 = 42, |
52 | B43 = 43, |
53 | B44 = 44, |
54 | B45 = 45, |
55 | B46 = 46, |
56 | B47 = 47, |
57 | B48 = 48, |
58 | B49 = 49, |
59 | B50 = 50, |
60 | B51 = 51, |
61 | B52 = 52, |
62 | B53 = 53, |
63 | B54 = 54, |
64 | B55 = 55, |
65 | B56 = 56, |
66 | B57 = 57, |
67 | B58 = 58, |
68 | B59 = 59, |
69 | B60 = 60, |
70 | B61 = 61, |
71 | B62 = 62, |
72 | B63 = 63, |
73 | B64 = 64, |
74 | B65 = 65, |
75 | B66 = 66, |
76 | B67 = 67, |
77 | B68 = 68, |
78 | B69 = 69, |
79 | B70 = 70, |
80 | B71 = 71, |
81 | B72 = 72, |
82 | B73 = 73, |
83 | B74 = 74, |
84 | B75 = 75, |
85 | B76 = 76, |
86 | B77 = 77, |
87 | B78 = 78, |
88 | B79 = 79, |
89 | B80 = 80, |
90 | B81 = 81, |
91 | B82 = 82, |
92 | B83 = 83, |
93 | B84 = 84, |
94 | B85 = 85, |
95 | B86 = 86, |
96 | B87 = 87, |
97 | B88 = 88, |
98 | B89 = 89, |
99 | B90 = 90, |
100 | B91 = 91, |
101 | B92 = 92, |
102 | B93 = 93, |
103 | B94 = 94, |
104 | B95 = 95, |
105 | B96 = 96, |
106 | B97 = 97, |
107 | B98 = 98, |
108 | B99 = 99, |
109 | B100 = 100, |
110 | B101 = 101, |
111 | B102 = 102, |
112 | B103 = 103, |
113 | B104 = 104, |
114 | B105 = 105, |
115 | B106 = 106, |
116 | B107 = 107, |
117 | B108 = 108, |
118 | B109 = 109, |
119 | B110 = 110, |
120 | B111 = 111, |
121 | B112 = 112, |
122 | B113 = 113, |
123 | B114 = 114, |
124 | B115 = 115, |
125 | B116 = 116, |
126 | B117 = 117, |
127 | B118 = 118, |
128 | B119 = 119, |
129 | B120 = 120, |
130 | B121 = 121, |
131 | B122 = 122, |
132 | B123 = 123, |
133 | B124 = 124, |
134 | B125 = 125, |
135 | B126 = 126, |
136 | B127 = 127, |
137 | } |
138 | |
139 | impl AsciiByte { |
140 | // Convert [u8; N] to [AsciiByte; N] |
141 | #[inline ] |
142 | pub const unsafe fn to_ascii_byte_array<const N: usize>(bytes: &[u8; N]) -> [AsciiByte; N] { |
143 | *(bytes as *const [u8; N] as *const [AsciiByte; N]) |
144 | } |
145 | } |
146 | |