strict_encoding/
stl.rs

1// Strict encoding library for deterministic binary serialization.
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5// Designed in 2019-2025 by Dr Maxim Orlovsky <orlovsky@ubideco.org>
6// Written in 2024-2025 by Dr Maxim Orlovsky <orlovsky@ubideco.org>
7//
8// Copyright (C) 2019-2022 LNP/BP Standards Association.
9// Copyright (C) 2022-2025 Laboratories for Ubiquitous Deterministic Computing (UBIDECO),
10//                         Institute for Distributed and Cognitive Systems (InDCS), Switzerland.
11// Copyright (C) 2019-2025 Dr Maxim Orlovsky.
12// All rights under the above copyrights are reserved.
13//
14// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
15// in compliance with the License. You may obtain a copy of the License at
16//
17//        http://www.apache.org/licenses/LICENSE-2.0
18//
19// Unless required by applicable law or agreed to in writing, software distributed under the License
20// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
21// or implied. See the License for the specific language governing permissions and limitations under
22// the License.
23
24#![allow(non_camel_case_types, unused_imports)]
25
26use std::borrow::Borrow;
27use std::fmt::{Debug, Display, Formatter};
28use std::marker::PhantomData;
29use std::ops::Deref;
30use std::str::FromStr;
31use std::{any, io};
32
33use amplify::ascii::{AsAsciiStrError, AsciiChar, AsciiString, FromAsciiError};
34use amplify::confinement;
35use amplify::confinement::Confined;
36use amplify::num::{u1, u2, u3, u4, u5, u6, u7};
37
38use crate::{
39    type_name, DecodeError, StrictDecode, StrictDumb, StrictEncode, StrictEnum, StrictSum,
40    StrictType, TypeName, TypedRead, TypedWrite, VariantError, LIB_NAME_STD,
41};
42
43// TODO: Move RString and related ASCII types to amplify library
44
45#[derive(Clone, Eq, PartialEq, Hash, Debug, Display, Error, From)]
46#[display(doc_comments)]
47pub enum InvalidRString {
48    /// must contain at least one character.
49    Empty,
50
51    /// string '{0}' must not start with character '{1}'.
52    DisallowedFirst(String, char),
53
54    /// string '{0}' contains invalid character '{1}' at position {2}.
55    InvalidChar(String, char, usize),
56
57    #[from(AsAsciiStrError)]
58    /// string contains non-ASCII character(s).
59    NonAsciiChar,
60
61    /// string has invalid length.
62    #[from]
63    Confinement(confinement::Error),
64}
65
66impl<O> From<FromAsciiError<O>> for InvalidRString {
67    fn from(_: FromAsciiError<O>) -> Self { InvalidRString::NonAsciiChar }
68}
69
70pub trait RestrictedCharSet:
71    Copy + Into<u8> + TryFrom<u8, Error = VariantError<u8>> + Display + StrictEncode + StrictDumb
72{
73}
74
75#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
76#[cfg_attr(feature = "serde", derive(Serialize), serde(transparent))]
77pub struct RString<
78    C1: RestrictedCharSet,
79    C: RestrictedCharSet = C1,
80    const MIN: usize = 1,
81    const MAX: usize = 255,
82> {
83    s: Confined<AsciiString, MIN, MAX>,
84    first: PhantomData<C1>,
85    rest: PhantomData<C>,
86}
87
88impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> Deref
89    for RString<C1, C, MIN, MAX>
90{
91    type Target = AsciiString;
92    fn deref(&self) -> &Self::Target { self.s.as_unconfined() }
93}
94
95impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> AsRef<[u8]>
96    for RString<C1, C, MIN, MAX>
97{
98    fn as_ref(&self) -> &[u8] { self.s.as_bytes() }
99}
100
101impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> AsRef<str>
102    for RString<C1, C, MIN, MAX>
103{
104    #[inline]
105    fn as_ref(&self) -> &str { self.s.as_str() }
106}
107
108impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> Borrow<str>
109    for RString<C1, C, MIN, MAX>
110{
111    fn borrow(&self) -> &str { self.s.as_str() }
112}
113
114impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> FromStr
115    for RString<C1, C, MIN, MAX>
116{
117    type Err = InvalidRString;
118
119    fn from_str(s: &str) -> Result<Self, Self::Err> { Self::try_from(s.as_bytes()) }
120}
121
122impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize>
123    From<&'static str> for RString<C1, C, MIN, MAX>
124{
125    /// # Safety
126    ///
127    /// Panics if the string contains invalid characters not matching
128    /// [`RestrictedCharSet`] requirements or the string length exceeds `MAX`.
129    fn from(s: &'static str) -> Self {
130        Self::try_from(s.as_bytes()).expect("invalid static string")
131    }
132}
133
134impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize>
135    TryFrom<String> for RString<C1, C, MIN, MAX>
136{
137    type Error = InvalidRString;
138
139    fn try_from(s: String) -> Result<Self, Self::Error> { Self::try_from(s.as_bytes()) }
140}
141
142impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize>
143    TryFrom<AsciiString> for RString<C1, C, MIN, MAX>
144{
145    type Error = InvalidRString;
146
147    fn try_from(ascii: AsciiString) -> Result<Self, InvalidRString> { ascii.as_bytes().try_into() }
148}
149
150impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize>
151    TryFrom<Vec<u8>> for RString<C1, C, MIN, MAX>
152{
153    type Error = InvalidRString;
154
155    fn try_from(vec: Vec<u8>) -> Result<Self, InvalidRString> { vec.as_slice().try_into() }
156}
157
158impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> TryFrom<&[u8]>
159    for RString<C1, C, MIN, MAX>
160{
161    type Error = InvalidRString;
162
163    fn try_from(bytes: &[u8]) -> Result<Self, InvalidRString> {
164        if bytes.is_empty() && MIN == 0 {
165            return Ok(Self {
166                s: Confined::from_checked(AsciiString::new()),
167                first: PhantomData,
168                rest: PhantomData,
169            });
170        }
171        let utf8 = String::from_utf8_lossy(bytes);
172        let mut iter = bytes.iter();
173        let Some(first) = iter.next() else {
174            return Err(InvalidRString::Empty);
175        };
176        if C1::try_from(*first).is_err() {
177            return Err(InvalidRString::DisallowedFirst(
178                utf8.to_string(),
179                utf8.chars().next().unwrap_or('?'),
180            ));
181        }
182        if let Some(pos) = iter.position(|ch| C::try_from(*ch).is_err()) {
183            return Err(InvalidRString::InvalidChar(
184                utf8.to_string(),
185                utf8.chars().nth(pos + 1).unwrap_or('?'),
186                pos + 1,
187            ));
188        }
189        let s = Confined::try_from(
190            AsciiString::from_ascii(bytes).expect("not an ASCII characted subset"),
191        )?;
192        Ok(Self {
193            s,
194            first: PhantomData,
195            rest: PhantomData,
196        })
197    }
198}
199
200impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize>
201    From<RString<C1, C, MIN, MAX>> for String
202{
203    fn from(s: RString<C1, C, MIN, MAX>) -> Self { s.s.release().into() }
204}
205
206impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> Debug
207    for RString<C1, C, MIN, MAX>
208{
209    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
210        let c = type_name::<C>();
211        let c1 = type_name::<C>();
212        let c = if c == c1 { c.to_owned() } else { format!("{c1}, {c}") };
213        f.debug_tuple(&format!("RString<{c}[{MIN}..{MAX}]>")).field(&self.as_str()).finish()
214    }
215}
216
217impl<C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize> Display
218    for RString<C1, C, MIN, MAX>
219{
220    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { Display::fmt(&self.s, f) }
221}
222
223#[cfg(feature = "serde")]
224mod _serde {
225    use serde::de::Error;
226    use serde::{Deserialize, Deserializer};
227
228    use super::*;
229
230    impl<'de, C1: RestrictedCharSet, C: RestrictedCharSet, const MIN: usize, const MAX: usize>
231        Deserialize<'de> for RString<C1, C, MIN, MAX>
232    {
233        fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
234        where D: Deserializer<'de> {
235            let ascii = AsciiString::deserialize(deserializer)?;
236            Self::try_from(ascii).map_err(D::Error::custom)
237        }
238    }
239}
240
241#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Default)]
242#[derive(StrictType, StrictEncode, StrictDecode)]
243#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
244#[repr(u8)]
245pub enum Bool {
246    #[default]
247    False = 0,
248    True = 1,
249}
250
251impl From<&bool> for Bool {
252    fn from(value: &bool) -> Self { Bool::from(*value) }
253}
254impl From<bool> for Bool {
255    fn from(value: bool) -> Self {
256        match value {
257            true => Bool::True,
258            false => Bool::False,
259        }
260    }
261}
262impl From<&Bool> for bool {
263    fn from(value: &Bool) -> Self { bool::from(*value) }
264}
265impl From<Bool> for bool {
266    fn from(value: Bool) -> Self {
267        match value {
268            Bool::False => false,
269            Bool::True => true,
270        }
271    }
272}
273
274impl StrictType for bool {
275    const STRICT_LIB_NAME: &'static str = LIB_NAME_STD;
276    fn strict_name() -> Option<TypeName> { Some(tn!("Bool")) }
277}
278impl StrictEncode for bool {
279    fn strict_encode<W: TypedWrite>(&self, writer: W) -> io::Result<W> {
280        writer.write_enum::<Bool>(Bool::from(self))
281    }
282}
283impl StrictDecode for bool {
284    fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError> {
285        let v: Bool = reader.read_enum()?;
286        Ok(bool::from(v))
287    }
288}
289
290macro_rules! impl_u {
291    ($ty:ident, $inner:ty, $( $no:ident )+) => {
292        #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Default)]
293        #[derive(StrictType, StrictEncode, StrictDecode)]
294        #[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
295        #[repr(u8)]
296        pub enum $ty {
297            #[default]
298            $( $no ),+
299        }
300
301        impl StrictType for $inner {
302            const STRICT_LIB_NAME: &'static str = LIB_NAME_STD;
303            fn strict_name() -> Option<TypeName> { Some(tn!(stringify!($ty))) }
304        }
305        impl StrictEncode for $inner {
306            fn strict_encode<W: TypedWrite>(&self, writer: W) -> io::Result<W> {
307                writer.write_enum::<$ty>($ty::try_from(self.to_u8())
308                    .expect(concat!("broken", stringify!($inner), "type guarantees")))
309            }
310        }
311        impl StrictDecode for $inner {
312            fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError> {
313                let v: $ty = reader.read_enum()?;
314                Ok(<$inner>::with(v as u8))
315            }
316        }
317    }
318}
319
320impl_u!(U1, u1, _0 _1);
321impl_u!(U2, u2, _0 _1 _2 _3);
322impl_u!(U3, u3, _0 _1 _2 _3 _4 _5 _6 _7);
323impl_u!(U4, u4, _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15);
324impl_u!(U5, u5, _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 
325                _10 _11 _12 _13 _14 _15 _16 _17 _18 _19 
326                _20 _21 _22 _23 _24 _25 _26 _27 _28 _29
327                _30 _31);
328impl_u!(U6, u6, _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 
329                _10 _11 _12 _13 _14 _15 _16 _17 _18 _19 
330                _20 _21 _22 _23 _24 _25 _26 _27 _28 _29
331                _30 _31 _32 _33 _34 _35 _36 _37 _38 _39
332                _40 _41 _42 _43 _44 _45 _46 _47 _48 _49
333                _50 _51 _52 _53 _54 _55 _56 _57 _58 _59
334                _60 _61 _62 _63);
335impl_u!(U7, u7, _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 
336                _10 _11 _12 _13 _14 _15 _16 _17 _18 _19 
337                _20 _21 _22 _23 _24 _25 _26 _27 _28 _29
338                _30 _31 _32 _33 _34 _35 _36 _37 _38 _39
339                _40 _41 _42 _43 _44 _45 _46 _47 _48 _49
340                _50 _51 _52 _53 _54 _55 _56 _57 _58 _59
341                _60 _61 _62 _63 _64 _65 _66 _67 _68 _69
342                _70 _71 _72 _73 _74 _75 _76 _77 _78 _79
343                _80 _81 _82 _83 _84 _85 _86 _87 _88 _89
344                _90 _91 _92 _93 _94 _95 _96 _97 _98 _99
345                _100 _101 _102 _103 _104 _105 _106 _107 _108 _109
346                _110 _111 _112 _113 _114 _115 _116 _117 _118 _119
347                _120 _121 _122 _123 _124 _125 _126 _127);
348
349#[derive(Wrapper, WrapperMut, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, From)]
350#[wrapper(Deref, Display, Debug)]
351#[wrapper_mut(DerefMut)]
352#[derive(StrictDumb)]
353#[strict_type(lib = LIB_NAME_STD, dumb = Self(AsciiChar::A), crate = crate)]
354pub struct AsciiSym(AsciiChar);
355
356impl From<AsciiSym> for u8 {
357    fn from(value: AsciiSym) -> Self { value.0.as_byte() }
358}
359
360impl TryFrom<u8> for AsciiSym {
361    type Error = VariantError<u8>;
362
363    fn try_from(value: u8) -> Result<Self, Self::Error> {
364        AsciiChar::from_ascii(value).map_err(|_| VariantError::with::<AsciiSym>(value)).map(Self)
365    }
366}
367impl StrictType for AsciiSym {
368    const STRICT_LIB_NAME: &'static str = LIB_NAME_STD;
369    fn strict_name() -> Option<TypeName> { Some(tn!("Ascii")) }
370}
371impl StrictSum for AsciiSym {
372    const ALL_VARIANTS: &'static [(u8, &'static str)] = &[
373        (b'\0', "nul"),
374        (0x01, "soh"),
375        (0x02, "stx"),
376        (0x03, "etx"),
377        (0x04, "eot"),
378        (0x05, "enq"),
379        (0x06, "ack"),
380        (0x07, "bel"),
381        (0x08, "bs"),
382        (b'\t', "ht"),
383        (b'\n', "lf"),
384        (0x0b, "vt"),
385        (0x0c, "ff"),
386        (b'\r', "cr"),
387        (0x0e, "so"),
388        (0x0f, "si"),
389        (0x10, "dle"),
390        (0x11, "dc1"),
391        (0x12, "dc2"),
392        (0x13, "dc3"),
393        (0x14, "dc4"),
394        (0x15, "nack"),
395        (0x16, "syn"),
396        (0x17, "etb"),
397        (0x18, "can"),
398        (0x19, "em"),
399        (0x1a, "sub"),
400        (0x1b, "esc"),
401        (0x1c, "fs"),
402        (0x1d, "gs"),
403        (0x1e, "rs"),
404        (0x1f, "us"),
405        (b' ', "space"),
406        (b'!', "excl"),
407        (b'"', "quotes"),
408        (b'#', "hash"),
409        (b'$', "dollar"),
410        (b'%', "percent"),
411        (b'&', "ampersand"),
412        (b'\'', "apostrophe"),
413        (b'(', "bracketL"),
414        (b')', "bracketR"),
415        (b'*', "asterisk"),
416        (b'+', "plus"),
417        (b',', "comma"),
418        (b'-', "minus"),
419        (b'.', "dot"),
420        (b'/', "slash"),
421        (b'0', "zero"),
422        (b'1', "one"),
423        (b'2', "two"),
424        (b'3', "three"),
425        (b'4', "four"),
426        (b'5', "five"),
427        (b'6', "six"),
428        (b'7', "seven"),
429        (b'8', "eight"),
430        (b'9', "nine"),
431        (b':', "colon"),
432        (b';', "semiColon"),
433        (b'<', "less"),
434        (b'=', "equal"),
435        (b'>', "greater"),
436        (b'?', "question"),
437        (b'@', "at"),
438        (b'A', "_A"),
439        (b'B', "_B"),
440        (b'C', "_C"),
441        (b'D', "_D"),
442        (b'E', "_E"),
443        (b'F', "_F"),
444        (b'G', "_G"),
445        (b'H', "_H"),
446        (b'I', "_I"),
447        (b'J', "_J"),
448        (b'K', "_K"),
449        (b'L', "_L"),
450        (b'M', "_M"),
451        (b'N', "_N"),
452        (b'O', "_O"),
453        (b'P', "_P"),
454        (b'Q', "_Q"),
455        (b'R', "_R"),
456        (b'S', "_S"),
457        (b'T', "_T"),
458        (b'U', "_U"),
459        (b'V', "_V"),
460        (b'W', "_W"),
461        (b'X', "_X"),
462        (b'Y', "_Y"),
463        (b'Z', "_Z"),
464        (b'[', "sqBracketL"),
465        (b'\\', "backSlash"),
466        (b']', "sqBracketR"),
467        (b'^', "caret"),
468        (b'_', "lodash"),
469        (b'`', "backtick"),
470        (b'a', "a"),
471        (b'b', "b"),
472        (b'c', "c"),
473        (b'd', "d"),
474        (b'e', "e"),
475        (b'f', "f"),
476        (b'g', "g"),
477        (b'h', "h"),
478        (b'i', "i"),
479        (b'j', "j"),
480        (b'k', "k"),
481        (b'l', "l"),
482        (b'm', "m"),
483        (b'n', "n"),
484        (b'o', "o"),
485        (b'p', "p"),
486        (b'q', "q"),
487        (b'r', "r"),
488        (b's', "s"),
489        (b't', "t"),
490        (b'u', "u"),
491        (b'v', "v"),
492        (b'w', "w"),
493        (b'x', "x"),
494        (b'y', "y"),
495        (b'z', "z"),
496        (b'{', "cBracketL"),
497        (b'|', "pipe"),
498        (b'}', "cBracketR"),
499        (b'~', "tilde"),
500        (0x7f, "del"),
501    ];
502    fn variant_name(&self) -> &'static str {
503        Self::ALL_VARIANTS
504            .iter()
505            .find(|(s, _)| *s == self.as_byte())
506            .map(|(_, v)| *v)
507            .expect("missed ASCII character variant")
508    }
509}
510impl StrictEnum for AsciiSym {}
511impl StrictEncode for AsciiSym {
512    fn strict_encode<W: TypedWrite>(&self, writer: W) -> io::Result<W> { writer.write_enum(*self) }
513}
514impl StrictDecode for AsciiSym {
515    fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError> {
516        reader.read_enum()
517    }
518}
519
520#[derive(Wrapper, WrapperMut, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, From)]
521#[wrapper(Deref, Display, Debug)]
522#[wrapper_mut(DerefMut)]
523#[derive(StrictDumb)]
524#[strict_type(lib = LIB_NAME_STD, dumb = Self(AsciiChar::A), crate = crate)]
525pub struct AsciiPrintable(AsciiChar);
526
527impl From<AsciiPrintable> for u8 {
528    fn from(value: AsciiPrintable) -> Self { value.0.as_byte() }
529}
530
531impl TryFrom<u8> for AsciiPrintable {
532    type Error = VariantError<u8>;
533
534    fn try_from(value: u8) -> Result<Self, Self::Error> {
535        AsciiChar::from_ascii(value)
536            .map_err(|_| VariantError::with::<AsciiPrintable>(value))
537            .map(Self)
538    }
539}
540
541impl StrictType for AsciiPrintable {
542    const STRICT_LIB_NAME: &'static str = LIB_NAME_STD;
543}
544
545impl StrictSum for AsciiPrintable {
546    const ALL_VARIANTS: &'static [(u8, &'static str)] = &[
547        (b' ', "space"),
548        (b'!', "excl"),
549        (b'"', "quotes"),
550        (b'#', "hash"),
551        (b'$', "dollar"),
552        (b'%', "percent"),
553        (b'&', "ampersand"),
554        (b'\'', "apostrophe"),
555        (b'(', "bracketL"),
556        (b')', "bracketR"),
557        (b'*', "asterisk"),
558        (b'+', "plus"),
559        (b',', "comma"),
560        (b'-', "minus"),
561        (b'.', "dot"),
562        (b'/', "slash"),
563        (b'0', "zero"),
564        (b'1', "one"),
565        (b'2', "two"),
566        (b'3', "three"),
567        (b'4', "four"),
568        (b'5', "five"),
569        (b'6', "six"),
570        (b'7', "seven"),
571        (b'8', "eight"),
572        (b'9', "nine"),
573        (b':', "colon"),
574        (b';', "semiColon"),
575        (b'<', "less"),
576        (b'=', "equal"),
577        (b'>', "greater"),
578        (b'?', "question"),
579        (b'@', "at"),
580        (b'A', "_A"),
581        (b'B', "_B"),
582        (b'C', "_C"),
583        (b'D', "_D"),
584        (b'E', "_E"),
585        (b'F', "_F"),
586        (b'G', "_G"),
587        (b'H', "_H"),
588        (b'I', "_I"),
589        (b'J', "_J"),
590        (b'K', "_K"),
591        (b'L', "_L"),
592        (b'M', "_M"),
593        (b'N', "_N"),
594        (b'O', "_O"),
595        (b'P', "_P"),
596        (b'Q', "_Q"),
597        (b'R', "_R"),
598        (b'S', "_S"),
599        (b'T', "_T"),
600        (b'U', "_U"),
601        (b'V', "_V"),
602        (b'W', "_W"),
603        (b'X', "_X"),
604        (b'Y', "_Y"),
605        (b'Z', "_Z"),
606        (b'[', "sqBracketL"),
607        (b'\\', "backSlash"),
608        (b']', "sqBracketR"),
609        (b'^', "caret"),
610        (b'_', "lodash"),
611        (b'`', "backtick"),
612        (b'a', "a"),
613        (b'b', "b"),
614        (b'c', "c"),
615        (b'd', "d"),
616        (b'e', "e"),
617        (b'f', "f"),
618        (b'g', "g"),
619        (b'h', "h"),
620        (b'i', "i"),
621        (b'j', "j"),
622        (b'k', "k"),
623        (b'l', "l"),
624        (b'm', "m"),
625        (b'n', "n"),
626        (b'o', "o"),
627        (b'p', "p"),
628        (b'q', "q"),
629        (b'r', "r"),
630        (b's', "s"),
631        (b't', "t"),
632        (b'u', "u"),
633        (b'v', "v"),
634        (b'w', "w"),
635        (b'x', "x"),
636        (b'y', "y"),
637        (b'z', "z"),
638        (b'{', "cBracketL"),
639        (b'|', "pipe"),
640        (b'}', "cBracketR"),
641        (b'~', "tilde"),
642    ];
643    fn variant_name(&self) -> &'static str {
644        Self::ALL_VARIANTS
645            .iter()
646            .find(|(s, _)| *s == self.as_byte())
647            .map(|(_, v)| *v)
648            .expect("missed ASCII character variant")
649    }
650}
651impl StrictEnum for AsciiPrintable {}
652impl StrictEncode for AsciiPrintable {
653    fn strict_encode<W: TypedWrite>(&self, writer: W) -> io::Result<W> { writer.write_enum(*self) }
654}
655impl StrictDecode for AsciiPrintable {
656    fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError> {
657        reader.read_enum()
658    }
659}
660
661#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
662#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
663#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
664#[display(inner)]
665#[repr(u8)]
666pub enum AlphaCaps {
667    #[strict_type(dumb, rename = "_A")]
668    A = b'A',
669    #[strict_type(rename = "_B")]
670    B = b'B',
671    #[strict_type(rename = "_C")]
672    C = b'C',
673    #[strict_type(rename = "_D")]
674    D = b'D',
675    #[strict_type(rename = "_E")]
676    E = b'E',
677    #[strict_type(rename = "_F")]
678    F = b'F',
679    #[strict_type(rename = "_G")]
680    G = b'G',
681    #[strict_type(rename = "_H")]
682    H = b'H',
683    #[strict_type(rename = "_I")]
684    I = b'I',
685    #[strict_type(rename = "_J")]
686    J = b'J',
687    #[strict_type(rename = "_K")]
688    K = b'K',
689    #[strict_type(rename = "_L")]
690    L = b'L',
691    #[strict_type(rename = "_M")]
692    M = b'M',
693    #[strict_type(rename = "_N")]
694    N = b'N',
695    #[strict_type(rename = "_O")]
696    O = b'O',
697    #[strict_type(rename = "_P")]
698    P = b'P',
699    #[strict_type(rename = "_Q")]
700    Q = b'Q',
701    #[strict_type(rename = "_R")]
702    R = b'R',
703    #[strict_type(rename = "_S")]
704    S = b'S',
705    #[strict_type(rename = "_T")]
706    T = b'T',
707    #[strict_type(rename = "_U")]
708    U = b'U',
709    #[strict_type(rename = "_V")]
710    V = b'V',
711    #[strict_type(rename = "_W")]
712    W = b'W',
713    #[strict_type(rename = "_X")]
714    X = b'X',
715    #[strict_type(rename = "_Y")]
716    Y = b'Y',
717    #[strict_type(rename = "_Z")]
718    Z = b'Z',
719}
720
721#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
722#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
723#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
724#[display(inner)]
725#[repr(u8)]
726pub enum AlphaCapsDot {
727    #[strict_type(dumb)]
728    #[display(".")]
729    Dot = b'.',
730    #[strict_type(rename = "_A")]
731    A = b'A',
732    #[strict_type(rename = "_B")]
733    B = b'B',
734    #[strict_type(rename = "_C")]
735    C = b'C',
736    #[strict_type(rename = "_D")]
737    D = b'D',
738    #[strict_type(rename = "_E")]
739    E = b'E',
740    #[strict_type(rename = "_F")]
741    F = b'F',
742    #[strict_type(rename = "_G")]
743    G = b'G',
744    #[strict_type(rename = "_H")]
745    H = b'H',
746    #[strict_type(rename = "_I")]
747    I = b'I',
748    #[strict_type(rename = "_J")]
749    J = b'J',
750    #[strict_type(rename = "_K")]
751    K = b'K',
752    #[strict_type(rename = "_L")]
753    L = b'L',
754    #[strict_type(rename = "_M")]
755    M = b'M',
756    #[strict_type(rename = "_N")]
757    N = b'N',
758    #[strict_type(rename = "_O")]
759    O = b'O',
760    #[strict_type(rename = "_P")]
761    P = b'P',
762    #[strict_type(rename = "_Q")]
763    Q = b'Q',
764    #[strict_type(rename = "_R")]
765    R = b'R',
766    #[strict_type(rename = "_S")]
767    S = b'S',
768    #[strict_type(rename = "_T")]
769    T = b'T',
770    #[strict_type(rename = "_U")]
771    U = b'U',
772    #[strict_type(rename = "_V")]
773    V = b'V',
774    #[strict_type(rename = "_W")]
775    W = b'W',
776    #[strict_type(rename = "_X")]
777    X = b'X',
778    #[strict_type(rename = "_Y")]
779    Y = b'Y',
780    #[strict_type(rename = "_Z")]
781    Z = b'Z',
782}
783
784#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
785#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
786#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
787#[display(inner)]
788#[repr(u8)]
789pub enum AlphaCapsDash {
790    #[strict_type(dumb)]
791    #[display("-")]
792    Dash = b'-',
793    #[strict_type(rename = "_A")]
794    A = b'A',
795    #[strict_type(rename = "_B")]
796    B = b'B',
797    #[strict_type(rename = "_C")]
798    C = b'C',
799    #[strict_type(rename = "_D")]
800    D = b'D',
801    #[strict_type(rename = "_E")]
802    E = b'E',
803    #[strict_type(rename = "_F")]
804    F = b'F',
805    #[strict_type(rename = "_G")]
806    G = b'G',
807    #[strict_type(rename = "_H")]
808    H = b'H',
809    #[strict_type(rename = "_I")]
810    I = b'I',
811    #[strict_type(rename = "_J")]
812    J = b'J',
813    #[strict_type(rename = "_K")]
814    K = b'K',
815    #[strict_type(rename = "_L")]
816    L = b'L',
817    #[strict_type(rename = "_M")]
818    M = b'M',
819    #[strict_type(rename = "_N")]
820    N = b'N',
821    #[strict_type(rename = "_O")]
822    O = b'O',
823    #[strict_type(rename = "_P")]
824    P = b'P',
825    #[strict_type(rename = "_Q")]
826    Q = b'Q',
827    #[strict_type(rename = "_R")]
828    R = b'R',
829    #[strict_type(rename = "_S")]
830    S = b'S',
831    #[strict_type(rename = "_T")]
832    T = b'T',
833    #[strict_type(rename = "_U")]
834    U = b'U',
835    #[strict_type(rename = "_V")]
836    V = b'V',
837    #[strict_type(rename = "_W")]
838    W = b'W',
839    #[strict_type(rename = "_X")]
840    X = b'X',
841    #[strict_type(rename = "_Y")]
842    Y = b'Y',
843    #[strict_type(rename = "_Z")]
844    Z = b'Z',
845}
846
847#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
848#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
849#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
850#[display(inner)]
851#[repr(u8)]
852pub enum AlphaCapsLodash {
853    #[strict_type(rename = "_A")]
854    A = b'A',
855    #[strict_type(rename = "_B")]
856    B = b'B',
857    #[strict_type(rename = "_C")]
858    C = b'C',
859    #[strict_type(rename = "_D")]
860    D = b'D',
861    #[strict_type(rename = "_E")]
862    E = b'E',
863    #[strict_type(rename = "_F")]
864    F = b'F',
865    #[strict_type(rename = "_G")]
866    G = b'G',
867    #[strict_type(rename = "_H")]
868    H = b'H',
869    #[strict_type(rename = "_I")]
870    I = b'I',
871    #[strict_type(rename = "_J")]
872    J = b'J',
873    #[strict_type(rename = "_K")]
874    K = b'K',
875    #[strict_type(rename = "_L")]
876    L = b'L',
877    #[strict_type(rename = "_M")]
878    M = b'M',
879    #[strict_type(rename = "_N")]
880    N = b'N',
881    #[strict_type(rename = "_O")]
882    O = b'O',
883    #[strict_type(rename = "_P")]
884    P = b'P',
885    #[strict_type(rename = "_Q")]
886    Q = b'Q',
887    #[strict_type(rename = "_R")]
888    R = b'R',
889    #[strict_type(rename = "_S")]
890    S = b'S',
891    #[strict_type(rename = "_T")]
892    T = b'T',
893    #[strict_type(rename = "_U")]
894    U = b'U',
895    #[strict_type(rename = "_V")]
896    V = b'V',
897    #[strict_type(rename = "_W")]
898    W = b'W',
899    #[strict_type(rename = "_X")]
900    X = b'X',
901    #[strict_type(rename = "_Y")]
902    Y = b'Y',
903    #[strict_type(rename = "_Z")]
904    Z = b'Z',
905    #[strict_type(dumb)]
906    #[display("_")]
907    Lodash = b'_',
908}
909
910#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
911#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
912#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
913#[repr(u8)]
914pub enum AlphaSmall {
915    #[strict_type(dumb)]
916    #[display("a")]
917    A = b'a',
918    #[display("b")]
919    B = b'b',
920    #[display("c")]
921    C = b'c',
922    #[display("d")]
923    D = b'd',
924    #[display("e")]
925    E = b'e',
926    #[display("f")]
927    F = b'f',
928    #[display("g")]
929    G = b'g',
930    #[display("h")]
931    H = b'h',
932    #[display("i")]
933    I = b'i',
934    #[display("j")]
935    J = b'j',
936    #[display("k")]
937    K = b'k',
938    #[display("l")]
939    L = b'l',
940    #[display("m")]
941    M = b'm',
942    #[display("n")]
943    N = b'n',
944    #[display("o")]
945    O = b'o',
946    #[display("p")]
947    P = b'p',
948    #[display("q")]
949    Q = b'q',
950    #[display("r")]
951    R = b'r',
952    #[display("s")]
953    S = b's',
954    #[display("t")]
955    T = b't',
956    #[display("u")]
957    U = b'u',
958    #[display("v")]
959    V = b'v',
960    #[display("w")]
961    W = b'w',
962    #[display("x")]
963    X = b'x',
964    #[display("y")]
965    Y = b'y',
966    #[display("z")]
967    Z = b'z',
968}
969
970#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
971#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
972#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
973#[repr(u8)]
974pub enum AlphaSmallDot {
975    #[strict_type(dumb)]
976    #[display(".")]
977    Dot = b'.',
978    #[display("a")]
979    A = b'a',
980    #[display("b")]
981    B = b'b',
982    #[display("c")]
983    C = b'c',
984    #[display("d")]
985    D = b'd',
986    #[display("e")]
987    E = b'e',
988    #[display("f")]
989    F = b'f',
990    #[display("g")]
991    G = b'g',
992    #[display("h")]
993    H = b'h',
994    #[display("i")]
995    I = b'i',
996    #[display("j")]
997    J = b'j',
998    #[display("k")]
999    K = b'k',
1000    #[display("l")]
1001    L = b'l',
1002    #[display("m")]
1003    M = b'm',
1004    #[display("n")]
1005    N = b'n',
1006    #[display("o")]
1007    O = b'o',
1008    #[display("p")]
1009    P = b'p',
1010    #[display("q")]
1011    Q = b'q',
1012    #[display("r")]
1013    R = b'r',
1014    #[display("s")]
1015    S = b's',
1016    #[display("t")]
1017    T = b't',
1018    #[display("u")]
1019    U = b'u',
1020    #[display("v")]
1021    V = b'v',
1022    #[display("w")]
1023    W = b'w',
1024    #[display("x")]
1025    X = b'x',
1026    #[display("y")]
1027    Y = b'y',
1028    #[display("z")]
1029    Z = b'z',
1030}
1031
1032#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1033#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1034#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1035#[repr(u8)]
1036pub enum AlphaSmallDash {
1037    #[strict_type(dumb)]
1038    #[display("-")]
1039    Dash = b'-',
1040    #[display("a")]
1041    A = b'a',
1042    #[display("b")]
1043    B = b'b',
1044    #[display("c")]
1045    C = b'c',
1046    #[display("d")]
1047    D = b'd',
1048    #[display("e")]
1049    E = b'e',
1050    #[display("f")]
1051    F = b'f',
1052    #[display("g")]
1053    G = b'g',
1054    #[display("h")]
1055    H = b'h',
1056    #[display("i")]
1057    I = b'i',
1058    #[display("j")]
1059    J = b'j',
1060    #[display("k")]
1061    K = b'k',
1062    #[display("l")]
1063    L = b'l',
1064    #[display("m")]
1065    M = b'm',
1066    #[display("n")]
1067    N = b'n',
1068    #[display("o")]
1069    O = b'o',
1070    #[display("p")]
1071    P = b'p',
1072    #[display("q")]
1073    Q = b'q',
1074    #[display("r")]
1075    R = b'r',
1076    #[display("s")]
1077    S = b's',
1078    #[display("t")]
1079    T = b't',
1080    #[display("u")]
1081    U = b'u',
1082    #[display("v")]
1083    V = b'v',
1084    #[display("w")]
1085    W = b'w',
1086    #[display("x")]
1087    X = b'x',
1088    #[display("y")]
1089    Y = b'y',
1090    #[display("z")]
1091    Z = b'z',
1092}
1093
1094#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1095#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1096#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1097#[repr(u8)]
1098pub enum AlphaSmallLodash {
1099    #[strict_type(dumb)]
1100    #[display("_")]
1101    Lodash = b'_',
1102    #[display("a")]
1103    A = b'a',
1104    #[display("b")]
1105    B = b'b',
1106    #[display("c")]
1107    C = b'c',
1108    #[display("d")]
1109    D = b'd',
1110    #[display("e")]
1111    E = b'e',
1112    #[display("f")]
1113    F = b'f',
1114    #[display("g")]
1115    G = b'g',
1116    #[display("h")]
1117    H = b'h',
1118    #[display("i")]
1119    I = b'i',
1120    #[display("j")]
1121    J = b'j',
1122    #[display("k")]
1123    K = b'k',
1124    #[display("l")]
1125    L = b'l',
1126    #[display("m")]
1127    M = b'm',
1128    #[display("n")]
1129    N = b'n',
1130    #[display("o")]
1131    O = b'o',
1132    #[display("p")]
1133    P = b'p',
1134    #[display("q")]
1135    Q = b'q',
1136    #[display("r")]
1137    R = b'r',
1138    #[display("s")]
1139    S = b's',
1140    #[display("t")]
1141    T = b't',
1142    #[display("u")]
1143    U = b'u',
1144    #[display("v")]
1145    V = b'v',
1146    #[display("w")]
1147    W = b'w',
1148    #[display("x")]
1149    X = b'x',
1150    #[display("y")]
1151    Y = b'y',
1152    #[display("z")]
1153    Z = b'z',
1154}
1155
1156#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1157#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1158#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1159#[display(inner)]
1160#[repr(u8)]
1161pub enum Alpha {
1162    #[strict_type(dumb, rename = "_A")]
1163    A = b'A',
1164    #[strict_type(rename = "_B")]
1165    B = b'B',
1166    #[strict_type(rename = "_C")]
1167    C = b'C',
1168    #[strict_type(rename = "_D")]
1169    D = b'D',
1170    #[strict_type(rename = "_E")]
1171    E = b'E',
1172    #[strict_type(rename = "_F")]
1173    F = b'F',
1174    #[strict_type(rename = "_G")]
1175    G = b'G',
1176    #[strict_type(rename = "_H")]
1177    H = b'H',
1178    #[strict_type(rename = "_I")]
1179    I = b'I',
1180    #[strict_type(rename = "_J")]
1181    J = b'J',
1182    #[strict_type(rename = "_K")]
1183    K = b'K',
1184    #[strict_type(rename = "_L")]
1185    L = b'L',
1186    #[strict_type(rename = "_M")]
1187    M = b'M',
1188    #[strict_type(rename = "_N")]
1189    N = b'N',
1190    #[strict_type(rename = "_O")]
1191    O = b'O',
1192    #[strict_type(rename = "_P")]
1193    P = b'P',
1194    #[strict_type(rename = "_Q")]
1195    Q = b'Q',
1196    #[strict_type(rename = "_R")]
1197    R = b'R',
1198    #[strict_type(rename = "_S")]
1199    S = b'S',
1200    #[strict_type(rename = "_T")]
1201    T = b'T',
1202    #[strict_type(rename = "_U")]
1203    U = b'U',
1204    #[strict_type(rename = "_V")]
1205    V = b'V',
1206    #[strict_type(rename = "_W")]
1207    W = b'W',
1208    #[strict_type(rename = "_X")]
1209    X = b'X',
1210    #[strict_type(rename = "_Y")]
1211    Y = b'Y',
1212    #[strict_type(rename = "_Z")]
1213    Z = b'Z',
1214    #[display("a")]
1215    a = b'a',
1216    #[display("b")]
1217    b = b'b',
1218    #[display("c")]
1219    c = b'c',
1220    #[display("d")]
1221    d = b'd',
1222    #[display("e")]
1223    e = b'e',
1224    #[display("f")]
1225    f = b'f',
1226    #[display("g")]
1227    g = b'g',
1228    #[display("h")]
1229    h = b'h',
1230    #[display("i")]
1231    i = b'i',
1232    #[display("j")]
1233    j = b'j',
1234    #[display("k")]
1235    k = b'k',
1236    #[display("l")]
1237    l = b'l',
1238    #[display("m")]
1239    m = b'm',
1240    #[display("n")]
1241    n = b'n',
1242    #[display("o")]
1243    o = b'o',
1244    #[display("p")]
1245    p = b'p',
1246    #[display("q")]
1247    q = b'q',
1248    #[display("r")]
1249    r = b'r',
1250    #[display("s")]
1251    s = b's',
1252    #[display("t")]
1253    t = b't',
1254    #[display("u")]
1255    u = b'u',
1256    #[display("v")]
1257    v = b'v',
1258    #[display("w")]
1259    w = b'w',
1260    #[display("x")]
1261    x = b'x',
1262    #[display("y")]
1263    y = b'y',
1264    #[display("z")]
1265    z = b'z',
1266}
1267
1268#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1269#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1270#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1271#[display(inner)]
1272#[repr(u8)]
1273pub enum AlphaDot {
1274    #[strict_type(dumb)]
1275    #[display(".")]
1276    Dot = b'.',
1277    #[strict_type(dumb, rename = "_A")]
1278    A = b'A',
1279    #[strict_type(rename = "_B")]
1280    B = b'B',
1281    #[strict_type(rename = "_C")]
1282    C = b'C',
1283    #[strict_type(rename = "_D")]
1284    D = b'D',
1285    #[strict_type(rename = "_E")]
1286    E = b'E',
1287    #[strict_type(rename = "_F")]
1288    F = b'F',
1289    #[strict_type(rename = "_G")]
1290    G = b'G',
1291    #[strict_type(rename = "_H")]
1292    H = b'H',
1293    #[strict_type(rename = "_I")]
1294    I = b'I',
1295    #[strict_type(rename = "_J")]
1296    J = b'J',
1297    #[strict_type(rename = "_K")]
1298    K = b'K',
1299    #[strict_type(rename = "_L")]
1300    L = b'L',
1301    #[strict_type(rename = "_M")]
1302    M = b'M',
1303    #[strict_type(rename = "_N")]
1304    N = b'N',
1305    #[strict_type(rename = "_O")]
1306    O = b'O',
1307    #[strict_type(rename = "_P")]
1308    P = b'P',
1309    #[strict_type(rename = "_Q")]
1310    Q = b'Q',
1311    #[strict_type(rename = "_R")]
1312    R = b'R',
1313    #[strict_type(rename = "_S")]
1314    S = b'S',
1315    #[strict_type(rename = "_T")]
1316    T = b'T',
1317    #[strict_type(rename = "_U")]
1318    U = b'U',
1319    #[strict_type(rename = "_V")]
1320    V = b'V',
1321    #[strict_type(rename = "_W")]
1322    W = b'W',
1323    #[strict_type(rename = "_X")]
1324    X = b'X',
1325    #[strict_type(rename = "_Y")]
1326    Y = b'Y',
1327    #[strict_type(rename = "_Z")]
1328    Z = b'Z',
1329    #[display("a")]
1330    a = b'a',
1331    #[display("b")]
1332    b = b'b',
1333    #[display("c")]
1334    c = b'c',
1335    #[display("d")]
1336    d = b'd',
1337    #[display("e")]
1338    e = b'e',
1339    #[display("f")]
1340    f = b'f',
1341    #[display("g")]
1342    g = b'g',
1343    #[display("h")]
1344    h = b'h',
1345    #[display("i")]
1346    i = b'i',
1347    #[display("j")]
1348    j = b'j',
1349    #[display("k")]
1350    k = b'k',
1351    #[display("l")]
1352    l = b'l',
1353    #[display("m")]
1354    m = b'm',
1355    #[display("n")]
1356    n = b'n',
1357    #[display("o")]
1358    o = b'o',
1359    #[display("p")]
1360    p = b'p',
1361    #[display("q")]
1362    q = b'q',
1363    #[display("r")]
1364    r = b'r',
1365    #[display("s")]
1366    s = b's',
1367    #[display("t")]
1368    t = b't',
1369    #[display("u")]
1370    u = b'u',
1371    #[display("v")]
1372    v = b'v',
1373    #[display("w")]
1374    w = b'w',
1375    #[display("x")]
1376    x = b'x',
1377    #[display("y")]
1378    y = b'y',
1379    #[display("z")]
1380    z = b'z',
1381}
1382
1383#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1384#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1385#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1386#[display(inner)]
1387#[repr(u8)]
1388pub enum AlphaDash {
1389    #[strict_type(dumb)]
1390    #[display("-")]
1391    Dash = b'-',
1392    #[strict_type(dumb, rename = "_A")]
1393    A = b'A',
1394    #[strict_type(rename = "_B")]
1395    B = b'B',
1396    #[strict_type(rename = "_C")]
1397    C = b'C',
1398    #[strict_type(rename = "_D")]
1399    D = b'D',
1400    #[strict_type(rename = "_E")]
1401    E = b'E',
1402    #[strict_type(rename = "_F")]
1403    F = b'F',
1404    #[strict_type(rename = "_G")]
1405    G = b'G',
1406    #[strict_type(rename = "_H")]
1407    H = b'H',
1408    #[strict_type(rename = "_I")]
1409    I = b'I',
1410    #[strict_type(rename = "_J")]
1411    J = b'J',
1412    #[strict_type(rename = "_K")]
1413    K = b'K',
1414    #[strict_type(rename = "_L")]
1415    L = b'L',
1416    #[strict_type(rename = "_M")]
1417    M = b'M',
1418    #[strict_type(rename = "_N")]
1419    N = b'N',
1420    #[strict_type(rename = "_O")]
1421    O = b'O',
1422    #[strict_type(rename = "_P")]
1423    P = b'P',
1424    #[strict_type(rename = "_Q")]
1425    Q = b'Q',
1426    #[strict_type(rename = "_R")]
1427    R = b'R',
1428    #[strict_type(rename = "_S")]
1429    S = b'S',
1430    #[strict_type(rename = "_T")]
1431    T = b'T',
1432    #[strict_type(rename = "_U")]
1433    U = b'U',
1434    #[strict_type(rename = "_V")]
1435    V = b'V',
1436    #[strict_type(rename = "_W")]
1437    W = b'W',
1438    #[strict_type(rename = "_X")]
1439    X = b'X',
1440    #[strict_type(rename = "_Y")]
1441    Y = b'Y',
1442    #[strict_type(rename = "_Z")]
1443    Z = b'Z',
1444    #[display("a")]
1445    a = b'a',
1446    #[display("b")]
1447    b = b'b',
1448    #[display("c")]
1449    c = b'c',
1450    #[display("d")]
1451    d = b'd',
1452    #[display("e")]
1453    e = b'e',
1454    #[display("f")]
1455    f = b'f',
1456    #[display("g")]
1457    g = b'g',
1458    #[display("h")]
1459    h = b'h',
1460    #[display("i")]
1461    i = b'i',
1462    #[display("j")]
1463    j = b'j',
1464    #[display("k")]
1465    k = b'k',
1466    #[display("l")]
1467    l = b'l',
1468    #[display("m")]
1469    m = b'm',
1470    #[display("n")]
1471    n = b'n',
1472    #[display("o")]
1473    o = b'o',
1474    #[display("p")]
1475    p = b'p',
1476    #[display("q")]
1477    q = b'q',
1478    #[display("r")]
1479    r = b'r',
1480    #[display("s")]
1481    s = b's',
1482    #[display("t")]
1483    t = b't',
1484    #[display("u")]
1485    u = b'u',
1486    #[display("v")]
1487    v = b'v',
1488    #[display("w")]
1489    w = b'w',
1490    #[display("x")]
1491    x = b'x',
1492    #[display("y")]
1493    y = b'y',
1494    #[display("z")]
1495    z = b'z',
1496}
1497
1498#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1499#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1500#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1501#[display(inner)]
1502#[repr(u8)]
1503pub enum AlphaLodash {
1504    #[strict_type(dumb, rename = "_A")]
1505    A = b'A',
1506    #[strict_type(rename = "_B")]
1507    B = b'B',
1508    #[strict_type(rename = "_C")]
1509    C = b'C',
1510    #[strict_type(rename = "_D")]
1511    D = b'D',
1512    #[strict_type(rename = "_E")]
1513    E = b'E',
1514    #[strict_type(rename = "_F")]
1515    F = b'F',
1516    #[strict_type(rename = "_G")]
1517    G = b'G',
1518    #[strict_type(rename = "_H")]
1519    H = b'H',
1520    #[strict_type(rename = "_I")]
1521    I = b'I',
1522    #[strict_type(rename = "_J")]
1523    J = b'J',
1524    #[strict_type(rename = "_K")]
1525    K = b'K',
1526    #[strict_type(rename = "_L")]
1527    L = b'L',
1528    #[strict_type(rename = "_M")]
1529    M = b'M',
1530    #[strict_type(rename = "_N")]
1531    N = b'N',
1532    #[strict_type(rename = "_O")]
1533    O = b'O',
1534    #[strict_type(rename = "_P")]
1535    P = b'P',
1536    #[strict_type(rename = "_Q")]
1537    Q = b'Q',
1538    #[strict_type(rename = "_R")]
1539    R = b'R',
1540    #[strict_type(rename = "_S")]
1541    S = b'S',
1542    #[strict_type(rename = "_T")]
1543    T = b'T',
1544    #[strict_type(rename = "_U")]
1545    U = b'U',
1546    #[strict_type(rename = "_V")]
1547    V = b'V',
1548    #[strict_type(rename = "_W")]
1549    W = b'W',
1550    #[strict_type(rename = "_X")]
1551    X = b'X',
1552    #[strict_type(rename = "_Y")]
1553    Y = b'Y',
1554    #[strict_type(rename = "_Z")]
1555    Z = b'Z',
1556    #[strict_type(dumb)]
1557    #[display("_")]
1558    Lodash = b'_',
1559    #[display("a")]
1560    a = b'a',
1561    #[display("b")]
1562    b = b'b',
1563    #[display("c")]
1564    c = b'c',
1565    #[display("d")]
1566    d = b'd',
1567    #[display("e")]
1568    e = b'e',
1569    #[display("f")]
1570    f = b'f',
1571    #[display("g")]
1572    g = b'g',
1573    #[display("h")]
1574    h = b'h',
1575    #[display("i")]
1576    i = b'i',
1577    #[display("j")]
1578    j = b'j',
1579    #[display("k")]
1580    k = b'k',
1581    #[display("l")]
1582    l = b'l',
1583    #[display("m")]
1584    m = b'm',
1585    #[display("n")]
1586    n = b'n',
1587    #[display("o")]
1588    o = b'o',
1589    #[display("p")]
1590    p = b'p',
1591    #[display("q")]
1592    q = b'q',
1593    #[display("r")]
1594    r = b'r',
1595    #[display("s")]
1596    s = b's',
1597    #[display("t")]
1598    t = b't',
1599    #[display("u")]
1600    u = b'u',
1601    #[display("v")]
1602    v = b'v',
1603    #[display("w")]
1604    w = b'w',
1605    #[display("x")]
1606    x = b'x',
1607    #[display("y")]
1608    y = b'y',
1609    #[display("z")]
1610    z = b'z',
1611}
1612
1613#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1614#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1615#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1616#[repr(u8)]
1617pub enum Dec {
1618    #[strict_type(dumb)]
1619    #[display("0")]
1620    Zero = b'0',
1621    #[display("1")]
1622    One = b'1',
1623    #[display("2")]
1624    Two = b'2',
1625    #[display("3")]
1626    Three = b'3',
1627    #[display("4")]
1628    Four = b'4',
1629    #[display("5")]
1630    Five = b'5',
1631    #[display("6")]
1632    Six = b'6',
1633    #[display("7")]
1634    Seven = b'7',
1635    #[display("8")]
1636    Eight = b'8',
1637    #[display("9")]
1638    Nine = b'9',
1639}
1640
1641#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1642#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1643#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1644#[repr(u8)]
1645pub enum DecDot {
1646    #[strict_type(dumb)]
1647    #[display(".")]
1648    Dot = b'.',
1649    #[display("0")]
1650    Zero = b'0',
1651    #[display("1")]
1652    One = b'1',
1653    #[display("2")]
1654    Two = b'2',
1655    #[display("3")]
1656    Three = b'3',
1657    #[display("4")]
1658    Four = b'4',
1659    #[display("5")]
1660    Five = b'5',
1661    #[display("6")]
1662    Six = b'6',
1663    #[display("7")]
1664    Seven = b'7',
1665    #[display("8")]
1666    Eight = b'8',
1667    #[display("9")]
1668    Nine = b'9',
1669}
1670
1671#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1672#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1673#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1674#[display(inner)]
1675#[repr(u8)]
1676pub enum HexDecCaps {
1677    #[strict_type(dumb)]
1678    #[display("0")]
1679    Zero = b'0',
1680    #[display("1")]
1681    One = b'1',
1682    #[display("2")]
1683    Two = b'2',
1684    #[display("3")]
1685    Three = b'3',
1686    #[display("4")]
1687    Four = b'4',
1688    #[display("5")]
1689    Five = b'5',
1690    #[display("6")]
1691    Six = b'6',
1692    #[display("7")]
1693    Seven = b'7',
1694    #[display("8")]
1695    Eight = b'8',
1696    #[display("9")]
1697    Nine = b'9',
1698    #[display("A")]
1699    Ten = b'A',
1700    #[display("B")]
1701    Eleven = b'B',
1702    #[display("C")]
1703    Twelve = b'C',
1704    #[display("D")]
1705    Thirteen = b'D',
1706    #[display("E")]
1707    Fourteen = b'E',
1708    #[display("F")]
1709    Fifteen = b'F',
1710}
1711
1712#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1713#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1714#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1715#[display(inner)]
1716#[repr(u8)]
1717pub enum HexDecSmall {
1718    #[strict_type(dumb)]
1719    #[display("0")]
1720    Zero = b'0',
1721    #[display("1")]
1722    One = b'1',
1723    #[display("2")]
1724    Two = b'2',
1725    #[display("3")]
1726    Three = b'3',
1727    #[display("4")]
1728    Four = b'4',
1729    #[display("5")]
1730    Five = b'5',
1731    #[display("6")]
1732    Six = b'6',
1733    #[display("7")]
1734    Seven = b'7',
1735    #[display("8")]
1736    Eight = b'8',
1737    #[display("9")]
1738    Nine = b'9',
1739    #[display("a")]
1740    Ten = b'a',
1741    #[display("b")]
1742    Eleven = b'b',
1743    #[display("c")]
1744    Twelve = b'c',
1745    #[display("d")]
1746    Thirteen = b'd',
1747    #[display("e")]
1748    Fourteen = b'e',
1749    #[display("f")]
1750    Fifteen = b'f',
1751}
1752
1753#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1754#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1755#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1756#[display(inner)]
1757#[repr(u8)]
1758pub enum AlphaCapsNum {
1759    #[display("0")]
1760    Zero = b'0',
1761    #[display("1")]
1762    One = b'1',
1763    #[display("2")]
1764    Two = b'2',
1765    #[display("3")]
1766    Three = b'3',
1767    #[display("4")]
1768    Four = b'4',
1769    #[display("5")]
1770    Five = b'5',
1771    #[display("6")]
1772    Six = b'6',
1773    #[display("7")]
1774    Seven = b'7',
1775    #[display("8")]
1776    Eight = b'8',
1777    #[display("9")]
1778    Nine = b'9',
1779    #[strict_type(dumb, rename = "_A")]
1780    A = b'A',
1781    #[strict_type(rename = "_B")]
1782    B = b'B',
1783    #[strict_type(rename = "_C")]
1784    C = b'C',
1785    #[strict_type(rename = "_D")]
1786    D = b'D',
1787    #[strict_type(rename = "_E")]
1788    E = b'E',
1789    #[strict_type(rename = "_F")]
1790    F = b'F',
1791    #[strict_type(rename = "_G")]
1792    G = b'G',
1793    #[strict_type(rename = "_H")]
1794    H = b'H',
1795    #[strict_type(rename = "_I")]
1796    I = b'I',
1797    #[strict_type(rename = "_J")]
1798    J = b'J',
1799    #[strict_type(rename = "_K")]
1800    K = b'K',
1801    #[strict_type(rename = "_L")]
1802    L = b'L',
1803    #[strict_type(rename = "_M")]
1804    M = b'M',
1805    #[strict_type(rename = "_N")]
1806    N = b'N',
1807    #[strict_type(rename = "_O")]
1808    O = b'O',
1809    #[strict_type(rename = "_P")]
1810    P = b'P',
1811    #[strict_type(rename = "_Q")]
1812    Q = b'Q',
1813    #[strict_type(rename = "_R")]
1814    R = b'R',
1815    #[strict_type(rename = "_S")]
1816    S = b'S',
1817    #[strict_type(rename = "_T")]
1818    T = b'T',
1819    #[strict_type(rename = "_U")]
1820    U = b'U',
1821    #[strict_type(rename = "_V")]
1822    V = b'V',
1823    #[strict_type(rename = "_W")]
1824    W = b'W',
1825    #[strict_type(rename = "_X")]
1826    X = b'X',
1827    #[strict_type(rename = "_Y")]
1828    Y = b'Y',
1829    #[strict_type(rename = "_Z")]
1830    Z = b'Z',
1831}
1832
1833#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1834#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1835#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1836#[display(inner)]
1837#[repr(u8)]
1838pub enum AlphaNum {
1839    #[display("0")]
1840    Zero = b'0',
1841    #[display("1")]
1842    One = b'1',
1843    #[display("2")]
1844    Two = b'2',
1845    #[display("3")]
1846    Three = b'3',
1847    #[display("4")]
1848    Four = b'4',
1849    #[display("5")]
1850    Five = b'5',
1851    #[display("6")]
1852    Six = b'6',
1853    #[display("7")]
1854    Seven = b'7',
1855    #[display("8")]
1856    Eight = b'8',
1857    #[display("9")]
1858    Nine = b'9',
1859    #[strict_type(dumb, rename = "_A")]
1860    A = b'A',
1861    #[strict_type(rename = "_B")]
1862    B = b'B',
1863    #[strict_type(rename = "_C")]
1864    C = b'C',
1865    #[strict_type(rename = "_D")]
1866    D = b'D',
1867    #[strict_type(rename = "_E")]
1868    E = b'E',
1869    #[strict_type(rename = "_F")]
1870    F = b'F',
1871    #[strict_type(rename = "_G")]
1872    G = b'G',
1873    #[strict_type(rename = "_H")]
1874    H = b'H',
1875    #[strict_type(rename = "_I")]
1876    I = b'I',
1877    #[strict_type(rename = "_J")]
1878    J = b'J',
1879    #[strict_type(rename = "_K")]
1880    K = b'K',
1881    #[strict_type(rename = "_L")]
1882    L = b'L',
1883    #[strict_type(rename = "_M")]
1884    M = b'M',
1885    #[strict_type(rename = "_N")]
1886    N = b'N',
1887    #[strict_type(rename = "_O")]
1888    O = b'O',
1889    #[strict_type(rename = "_P")]
1890    P = b'P',
1891    #[strict_type(rename = "_Q")]
1892    Q = b'Q',
1893    #[strict_type(rename = "_R")]
1894    R = b'R',
1895    #[strict_type(rename = "_S")]
1896    S = b'S',
1897    #[strict_type(rename = "_T")]
1898    T = b'T',
1899    #[strict_type(rename = "_U")]
1900    U = b'U',
1901    #[strict_type(rename = "_V")]
1902    V = b'V',
1903    #[strict_type(rename = "_W")]
1904    W = b'W',
1905    #[strict_type(rename = "_X")]
1906    X = b'X',
1907    #[strict_type(rename = "_Y")]
1908    Y = b'Y',
1909    #[strict_type(rename = "_Z")]
1910    Z = b'Z',
1911    #[display("a")]
1912    a = b'a',
1913    #[display("b")]
1914    b = b'b',
1915    #[display("c")]
1916    c = b'c',
1917    #[display("d")]
1918    d = b'd',
1919    #[display("e")]
1920    e = b'e',
1921    #[display("f")]
1922    f = b'f',
1923    #[display("g")]
1924    g = b'g',
1925    #[display("h")]
1926    h = b'h',
1927    #[display("i")]
1928    i = b'i',
1929    #[display("j")]
1930    j = b'j',
1931    #[display("k")]
1932    k = b'k',
1933    #[display("l")]
1934    l = b'l',
1935    #[display("m")]
1936    m = b'm',
1937    #[display("n")]
1938    n = b'n',
1939    #[display("o")]
1940    o = b'o',
1941    #[display("p")]
1942    p = b'p',
1943    #[display("q")]
1944    q = b'q',
1945    #[display("r")]
1946    r = b'r',
1947    #[display("s")]
1948    s = b's',
1949    #[display("t")]
1950    t = b't',
1951    #[display("u")]
1952    u = b'u',
1953    #[display("v")]
1954    v = b'v',
1955    #[display("w")]
1956    w = b'w',
1957    #[display("x")]
1958    x = b'x',
1959    #[display("y")]
1960    y = b'y',
1961    #[display("z")]
1962    z = b'z',
1963}
1964
1965#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
1966#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
1967#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
1968#[display(inner)]
1969#[repr(u8)]
1970pub enum AlphaNumDot {
1971    #[strict_type(dumb)]
1972    #[display(".")]
1973    Dot = b'.',
1974    #[display("0")]
1975    Zero = b'0',
1976    #[display("1")]
1977    One = b'1',
1978    #[display("2")]
1979    Two = b'2',
1980    #[display("3")]
1981    Three = b'3',
1982    #[display("4")]
1983    Four = b'4',
1984    #[display("5")]
1985    Five = b'5',
1986    #[display("6")]
1987    Six = b'6',
1988    #[display("7")]
1989    Seven = b'7',
1990    #[display("8")]
1991    Eight = b'8',
1992    #[display("9")]
1993    Nine = b'9',
1994    #[strict_type(dumb, rename = "_A")]
1995    A = b'A',
1996    #[strict_type(rename = "_B")]
1997    B = b'B',
1998    #[strict_type(rename = "_C")]
1999    C = b'C',
2000    #[strict_type(rename = "_D")]
2001    D = b'D',
2002    #[strict_type(rename = "_E")]
2003    E = b'E',
2004    #[strict_type(rename = "_F")]
2005    F = b'F',
2006    #[strict_type(rename = "_G")]
2007    G = b'G',
2008    #[strict_type(rename = "_H")]
2009    H = b'H',
2010    #[strict_type(rename = "_I")]
2011    I = b'I',
2012    #[strict_type(rename = "_J")]
2013    J = b'J',
2014    #[strict_type(rename = "_K")]
2015    K = b'K',
2016    #[strict_type(rename = "_L")]
2017    L = b'L',
2018    #[strict_type(rename = "_M")]
2019    M = b'M',
2020    #[strict_type(rename = "_N")]
2021    N = b'N',
2022    #[strict_type(rename = "_O")]
2023    O = b'O',
2024    #[strict_type(rename = "_P")]
2025    P = b'P',
2026    #[strict_type(rename = "_Q")]
2027    Q = b'Q',
2028    #[strict_type(rename = "_R")]
2029    R = b'R',
2030    #[strict_type(rename = "_S")]
2031    S = b'S',
2032    #[strict_type(rename = "_T")]
2033    T = b'T',
2034    #[strict_type(rename = "_U")]
2035    U = b'U',
2036    #[strict_type(rename = "_V")]
2037    V = b'V',
2038    #[strict_type(rename = "_W")]
2039    W = b'W',
2040    #[strict_type(rename = "_X")]
2041    X = b'X',
2042    #[strict_type(rename = "_Y")]
2043    Y = b'Y',
2044    #[strict_type(rename = "_Z")]
2045    Z = b'Z',
2046    #[display("a")]
2047    a = b'a',
2048    #[display("b")]
2049    b = b'b',
2050    #[display("c")]
2051    c = b'c',
2052    #[display("d")]
2053    d = b'd',
2054    #[display("e")]
2055    e = b'e',
2056    #[display("f")]
2057    f = b'f',
2058    #[display("g")]
2059    g = b'g',
2060    #[display("h")]
2061    h = b'h',
2062    #[display("i")]
2063    i = b'i',
2064    #[display("j")]
2065    j = b'j',
2066    #[display("k")]
2067    k = b'k',
2068    #[display("l")]
2069    l = b'l',
2070    #[display("m")]
2071    m = b'm',
2072    #[display("n")]
2073    n = b'n',
2074    #[display("o")]
2075    o = b'o',
2076    #[display("p")]
2077    p = b'p',
2078    #[display("q")]
2079    q = b'q',
2080    #[display("r")]
2081    r = b'r',
2082    #[display("s")]
2083    s = b's',
2084    #[display("t")]
2085    t = b't',
2086    #[display("u")]
2087    u = b'u',
2088    #[display("v")]
2089    v = b'v',
2090    #[display("w")]
2091    w = b'w',
2092    #[display("x")]
2093    x = b'x',
2094    #[display("y")]
2095    y = b'y',
2096    #[display("z")]
2097    z = b'z',
2098}
2099
2100#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
2101#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
2102#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
2103#[display(inner)]
2104#[repr(u8)]
2105pub enum AlphaNumDash {
2106    #[strict_type(dumb)]
2107    #[display("-")]
2108    Dash = b'-',
2109    #[display("0")]
2110    Zero = b'0',
2111    #[display("1")]
2112    One = b'1',
2113    #[display("2")]
2114    Two = b'2',
2115    #[display("3")]
2116    Three = b'3',
2117    #[display("4")]
2118    Four = b'4',
2119    #[display("5")]
2120    Five = b'5',
2121    #[display("6")]
2122    Six = b'6',
2123    #[display("7")]
2124    Seven = b'7',
2125    #[display("8")]
2126    Eight = b'8',
2127    #[display("9")]
2128    Nine = b'9',
2129    #[strict_type(dumb, rename = "_A")]
2130    A = b'A',
2131    #[strict_type(rename = "_B")]
2132    B = b'B',
2133    #[strict_type(rename = "_C")]
2134    C = b'C',
2135    #[strict_type(rename = "_D")]
2136    D = b'D',
2137    #[strict_type(rename = "_E")]
2138    E = b'E',
2139    #[strict_type(rename = "_F")]
2140    F = b'F',
2141    #[strict_type(rename = "_G")]
2142    G = b'G',
2143    #[strict_type(rename = "_H")]
2144    H = b'H',
2145    #[strict_type(rename = "_I")]
2146    I = b'I',
2147    #[strict_type(rename = "_J")]
2148    J = b'J',
2149    #[strict_type(rename = "_K")]
2150    K = b'K',
2151    #[strict_type(rename = "_L")]
2152    L = b'L',
2153    #[strict_type(rename = "_M")]
2154    M = b'M',
2155    #[strict_type(rename = "_N")]
2156    N = b'N',
2157    #[strict_type(rename = "_O")]
2158    O = b'O',
2159    #[strict_type(rename = "_P")]
2160    P = b'P',
2161    #[strict_type(rename = "_Q")]
2162    Q = b'Q',
2163    #[strict_type(rename = "_R")]
2164    R = b'R',
2165    #[strict_type(rename = "_S")]
2166    S = b'S',
2167    #[strict_type(rename = "_T")]
2168    T = b'T',
2169    #[strict_type(rename = "_U")]
2170    U = b'U',
2171    #[strict_type(rename = "_V")]
2172    V = b'V',
2173    #[strict_type(rename = "_W")]
2174    W = b'W',
2175    #[strict_type(rename = "_X")]
2176    X = b'X',
2177    #[strict_type(rename = "_Y")]
2178    Y = b'Y',
2179    #[strict_type(rename = "_Z")]
2180    Z = b'Z',
2181    #[display("a")]
2182    a = b'a',
2183    #[display("b")]
2184    b = b'b',
2185    #[display("c")]
2186    c = b'c',
2187    #[display("d")]
2188    d = b'd',
2189    #[display("e")]
2190    e = b'e',
2191    #[display("f")]
2192    f = b'f',
2193    #[display("g")]
2194    g = b'g',
2195    #[display("h")]
2196    h = b'h',
2197    #[display("i")]
2198    i = b'i',
2199    #[display("j")]
2200    j = b'j',
2201    #[display("k")]
2202    k = b'k',
2203    #[display("l")]
2204    l = b'l',
2205    #[display("m")]
2206    m = b'm',
2207    #[display("n")]
2208    n = b'n',
2209    #[display("o")]
2210    o = b'o',
2211    #[display("p")]
2212    p = b'p',
2213    #[display("q")]
2214    q = b'q',
2215    #[display("r")]
2216    r = b'r',
2217    #[display("s")]
2218    s = b's',
2219    #[display("t")]
2220    t = b't',
2221    #[display("u")]
2222    u = b'u',
2223    #[display("v")]
2224    v = b'v',
2225    #[display("w")]
2226    w = b'w',
2227    #[display("x")]
2228    x = b'x',
2229    #[display("y")]
2230    y = b'y',
2231    #[display("z")]
2232    z = b'z',
2233}
2234
2235#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Display)]
2236#[derive(StrictDumb, StrictType, StrictEncode, StrictDecode)]
2237#[strict_type(lib = LIB_NAME_STD, tags = repr, into_u8, try_from_u8, crate = crate)]
2238#[display(inner)]
2239#[repr(u8)]
2240pub enum AlphaNumLodash {
2241    #[display("0")]
2242    Zero = b'0',
2243    #[display("1")]
2244    One = b'1',
2245    #[display("2")]
2246    Two = b'2',
2247    #[display("3")]
2248    Three = b'3',
2249    #[display("4")]
2250    Four = b'4',
2251    #[display("5")]
2252    Five = b'5',
2253    #[display("6")]
2254    Six = b'6',
2255    #[display("7")]
2256    Seven = b'7',
2257    #[display("8")]
2258    Eight = b'8',
2259    #[display("9")]
2260    Nine = b'9',
2261    #[strict_type(rename = "_A")]
2262    A = b'A',
2263    #[strict_type(rename = "_B")]
2264    B = b'B',
2265    #[strict_type(rename = "_C")]
2266    C = b'C',
2267    #[strict_type(rename = "_D")]
2268    D = b'D',
2269    #[strict_type(rename = "_E")]
2270    E = b'E',
2271    #[strict_type(rename = "_F")]
2272    F = b'F',
2273    #[strict_type(rename = "_G")]
2274    G = b'G',
2275    #[strict_type(rename = "_H")]
2276    H = b'H',
2277    #[strict_type(rename = "_I")]
2278    I = b'I',
2279    #[strict_type(rename = "_J")]
2280    J = b'J',
2281    #[strict_type(rename = "_K")]
2282    K = b'K',
2283    #[strict_type(rename = "_L")]
2284    L = b'L',
2285    #[strict_type(rename = "_M")]
2286    M = b'M',
2287    #[strict_type(rename = "_N")]
2288    N = b'N',
2289    #[strict_type(rename = "_O")]
2290    O = b'O',
2291    #[strict_type(rename = "_P")]
2292    P = b'P',
2293    #[strict_type(rename = "_Q")]
2294    Q = b'Q',
2295    #[strict_type(rename = "_R")]
2296    R = b'R',
2297    #[strict_type(rename = "_S")]
2298    S = b'S',
2299    #[strict_type(rename = "_T")]
2300    T = b'T',
2301    #[strict_type(rename = "_U")]
2302    U = b'U',
2303    #[strict_type(rename = "_V")]
2304    V = b'V',
2305    #[strict_type(rename = "_W")]
2306    W = b'W',
2307    #[strict_type(rename = "_X")]
2308    X = b'X',
2309    #[strict_type(rename = "_Y")]
2310    Y = b'Y',
2311    #[strict_type(rename = "_Z")]
2312    Z = b'Z',
2313    #[strict_type(dumb)]
2314    #[display("_")]
2315    Lodash = b'_',
2316    #[display("a")]
2317    a = b'a',
2318    #[display("b")]
2319    b = b'b',
2320    #[display("c")]
2321    c = b'c',
2322    #[display("d")]
2323    d = b'd',
2324    #[display("e")]
2325    e = b'e',
2326    #[display("f")]
2327    f = b'f',
2328    #[display("g")]
2329    g = b'g',
2330    #[display("h")]
2331    h = b'h',
2332    #[display("i")]
2333    i = b'i',
2334    #[display("j")]
2335    j = b'j',
2336    #[display("k")]
2337    k = b'k',
2338    #[display("l")]
2339    l = b'l',
2340    #[display("m")]
2341    m = b'm',
2342    #[display("n")]
2343    n = b'n',
2344    #[display("o")]
2345    o = b'o',
2346    #[display("p")]
2347    p = b'p',
2348    #[display("q")]
2349    q = b'q',
2350    #[display("r")]
2351    r = b'r',
2352    #[display("s")]
2353    s = b's',
2354    #[display("t")]
2355    t = b't',
2356    #[display("u")]
2357    u = b'u',
2358    #[display("v")]
2359    v = b'v',
2360    #[display("w")]
2361    w = b'w',
2362    #[display("x")]
2363    x = b'x',
2364    #[display("y")]
2365    y = b'y',
2366    #[display("z")]
2367    z = b'z',
2368}
2369
2370impl RestrictedCharSet for AsciiPrintable {}
2371impl RestrictedCharSet for AsciiSym {}
2372impl RestrictedCharSet for Alpha {}
2373impl RestrictedCharSet for AlphaDot {}
2374impl RestrictedCharSet for AlphaDash {}
2375impl RestrictedCharSet for AlphaLodash {}
2376impl RestrictedCharSet for AlphaCaps {}
2377impl RestrictedCharSet for AlphaCapsDot {}
2378impl RestrictedCharSet for AlphaCapsDash {}
2379impl RestrictedCharSet for AlphaCapsLodash {}
2380impl RestrictedCharSet for AlphaSmall {}
2381impl RestrictedCharSet for AlphaSmallDot {}
2382impl RestrictedCharSet for AlphaSmallDash {}
2383impl RestrictedCharSet for AlphaSmallLodash {}
2384impl RestrictedCharSet for AlphaNum {}
2385impl RestrictedCharSet for AlphaNumDot {}
2386impl RestrictedCharSet for AlphaNumDash {}
2387impl RestrictedCharSet for AlphaNumLodash {}
2388impl RestrictedCharSet for AlphaCapsNum {}
2389impl RestrictedCharSet for Dec {}
2390impl RestrictedCharSet for DecDot {}
2391impl RestrictedCharSet for HexDecCaps {}
2392impl RestrictedCharSet for HexDecSmall {}
2393
2394#[cfg(test)]
2395mod test {
2396    use super::*;
2397
2398    #[test]
2399    fn rstring_utf8() {
2400        let s = "Юникод";
2401        assert_eq!(
2402            RString::<AlphaCaps, Alpha, 1, 8>::from_str(s).unwrap_err(),
2403            InvalidRString::DisallowedFirst(s.to_owned(), 'Ю')
2404        );
2405
2406        let s = "Uникод";
2407        assert_eq!(
2408            RString::<AlphaCaps, Alpha, 1, 8>::from_str(s).unwrap_err(),
2409            InvalidRString::InvalidChar(s.to_owned(), 'н', 1)
2410        );
2411    }
2412}