quack_builder/
keywords.rs1static RUST_KEYWORDS: [&str; 75] = [
2    "abstract",
3    "alignof",
4    "as",
5    "become",
6    "bool",
7    "box",
8    "Box",
9    "break",
10    "BytesReader",
11    "const",
12    "continue",
13    "crate",
14    "Cow",
15    "Default",
16    "do",
17    "else",
18    "enum",
19    "Err",
20    "extern",
21    "f32",
22    "f64",
23    "false",
24    "final",
25    "fn",
26    "for",
27    "HashMap",
28    "i32",
29    "i64",
30    "if",
31    "impl",
32    "in",
33    "let",
34    "loop",
35    "match",
36    "mod",
37    "move",
38    "mut",
39    "None",
40    "MessageWrite",
41    "offsetof",
42    "Ok",
43    "Option",
44    "override",
45    "priv",
46    "pub",
47    "pure",
48    "ref",
49    "Result",
50    "return",
51    "self",
52    "Self",
53    "sizeof",
54    "Some",
55    "static",
56    "str",
57    "String",
58    "struct",
59    "super",
60    "trait",
61    "true",
62    "type",
63    "typeof",
64    "u8",
65    "u32",
66    "u64",
67    "unsafe",
68    "unsized",
69    "use",
70    "Vec",
71    "virtual",
72    "where",
73    "while",
74    "Write",
75    "Writer",
76    "yield",
77];
78
79pub fn sanitize_keyword(ident: &mut String) {
81    if !ident.contains('.') && RUST_KEYWORDS.contains(&&**ident) {
82        ident.push_str("_pb");
83    } else {
84        *ident = ident
85            .split('.')
86            .map(|s| {
87                if RUST_KEYWORDS.contains(&s) {
88                    format!("{}_pb", s)
89                } else {
90                    s.to_string()
91                }
92            })
93            .collect::<Vec<_>>()
94            .join(".");
95    }
96}