macro_tools/
kw.rs

1//!
2//! Keywords
3//!
4
5/// Define a private namespace for all its items.
6mod private
7{
8  // use crate::*;
9
10  const KEYWORDS : &[ &str ] =
11  &[
12    "as", "break", "const", "continue", "crate", "else", "enum", "extern", "false", "fn",
13    "for", "if", "impl", "in", "let", "loop", "match", "mod", "move", "mut", "pub", "ref",
14    "return", "self", "Self", "static", "struct", "super", "trait", "true", "type", "unsafe",
15    "use", "where", "while", "async", "await", "dyn", "box", "try", "macro",
16  ];
17
18  // qqq : cover by test
19  /// Check is string a keyword.
20  #[ must_use ]
21  pub fn is( src : &str ) -> bool
22  {
23    KEYWORDS.contains( &src )
24  }
25
26}
27
28#[ doc( inline ) ]
29#[ allow( unused_imports ) ]
30pub use own::*;
31
32/// Own namespace of the module.
33#[ allow( unused_imports ) ]
34pub mod own
35{
36  #[ allow( clippy::wildcard_imports ) ]
37  use super::*;
38  #[ doc( inline ) ]
39  pub use orphan::*;
40}
41
42/// Orphan namespace of the module.
43#[ allow( unused_imports ) ]
44pub mod orphan
45{
46  #[ allow( clippy::wildcard_imports ) ]
47  use super::*;
48  #[ doc( inline ) ]
49  pub use exposed::*;
50}
51
52/// Exposed namespace of the module.
53#[ allow( unused_imports ) ]
54pub mod exposed
55{
56  #[ allow( clippy::wildcard_imports ) ]
57  use super::*;
58  pub use super::super::kw;
59
60  #[ doc( inline ) ]
61  pub use prelude::*;
62  #[ doc( inline ) ]
63  pub use private::
64  {
65    is,
66  };
67}
68
69/// Prelude to use essentials: `use my_module::prelude::*`.
70#[ allow( unused_imports ) ]
71pub mod prelude
72{
73  use super::*;
74}
75