22Human-friendly notation for Unicode symbols.
33*/
44
5- /// A module of definitions.
6- #[ derive( Debug , Copy , Clone ) ]
7- pub struct Module ( & ' static [ ( & ' static str , Binding ) ] ) ;
5+ include ! ( "shared.rs" ) ;
6+
7+ type StaticSlice < T > = & ' static [ T ] ;
8+ declare_types ! {
9+ derive( Debug , Copy , Clone ) ,
10+ str = & ' static str ,
11+ List = StaticSlice <_>
12+ }
813
914impl Module {
1015 /// Try to get a bound definition in the module.
@@ -21,40 +26,6 @@ impl Module {
2126 }
2227}
2328
24- /// A definition bound in a module, with metadata.
25- #[ derive( Debug , Copy , Clone ) ]
26- pub struct Binding {
27- /// The bound definition.
28- pub def : Def ,
29- /// A deprecation message for the definition, if it is deprecated.
30- pub deprecation : Option < & ' static str > ,
31- }
32-
33- impl Binding {
34- /// Create a new bound definition.
35- pub const fn new ( definition : Def ) -> Self {
36- Self { def : definition, deprecation : None }
37- }
38- }
39-
40- /// A definition in a module.
41- #[ derive( Debug , Copy , Clone ) ]
42- pub enum Def {
43- /// A symbol, potentially with modifiers.
44- Symbol ( Symbol ) ,
45- /// A nested module.
46- Module ( Module ) ,
47- }
48-
49- /// A symbol, either a leaf or with modifiers.
50- #[ derive( Debug , Copy , Clone ) ]
51- pub enum Symbol {
52- /// A symbol without modifiers.
53- Single ( char ) ,
54- /// A symbol with named modifiers. The symbol defaults to its first variant.
55- Multi ( & ' static [ ( & ' static str , char ) ] ) ,
56- }
57-
5829/// A module that contains the other top-level modules.
5930pub const ROOT : Module = Module ( & [
6031 ( "emoji" , Binding :: new ( Def :: Module ( EMOJI ) ) ) ,
0 commit comments