Skip to main content

weldscli_lib/generators/
mod.rs

1pub(crate) mod models;
2
3pub(crate) fn keyword_sanitize(name: impl Into<String>) -> String {
4    let n = name.into();
5    match n.as_str() {
6        "as" => "as_".to_owned(),
7        "break" => "break_".to_owned(),
8        "const" => "const_".to_owned(),
9        "continue" => "continue_".to_owned(),
10        "crate" => "crate_".to_owned(),
11        "else" => "else_".to_owned(),
12        "enum" => "enum_".to_owned(),
13        "extern" => "extern_".to_owned(),
14        "false" => "false_".to_owned(),
15        "fn" => "fn_".to_owned(),
16        "for" => "for_".to_owned(),
17        "if" => "if_".to_owned(),
18        "impl" => "impl_".to_owned(),
19        "in" => "in_".to_owned(),
20        "let" => "let_".to_owned(),
21        "loop" => "loop_".to_owned(),
22        "match" => "match_".to_owned(),
23        "mod" => "mod_".to_owned(),
24        "move" => "move_".to_owned(),
25        "mut" => "mut_".to_owned(),
26        "pub" => "pub_".to_owned(),
27        "ref" => "ref_".to_owned(),
28        "return" => "return_".to_owned(),
29        "self" => "self_".to_owned(),
30        "Self" => "Self_".to_owned(),
31        "static" => "static_".to_owned(),
32        "struct" => "struct_".to_owned(),
33        "super" => "super_".to_owned(),
34        "trait" => "trait_".to_owned(),
35        "true" => "true_".to_owned(),
36        "type" => "type_".to_owned(),
37        "unsafe" => "unsafe_".to_owned(),
38        "use" => "use_".to_owned(),
39        "where" => "where_".to_owned(),
40        "while" => "while_".to_owned(),
41        "async" => "async_".to_owned(),
42        "await" => "await_".to_owned(),
43        "dyn" => "dyn_".to_owned(),
44        "abstract" => "abstract_".to_owned(),
45        "become" => "become_".to_owned(),
46        "box" => "box_".to_owned(),
47        "do" => "do_".to_owned(),
48        "final" => "final_".to_owned(),
49        "macro" => "macro_".to_owned(),
50        "override" => "override_".to_owned(),
51        "priv" => "priv_".to_owned(),
52        "typeof" => "typeof_".to_owned(),
53        "unsized" => "unsized_".to_owned(),
54        "virtual" => "virtual_".to_owned(),
55        "yield" => "yield_".to_owned(),
56        "try" => "try_".to_owned(),
57        "union" => "union_".to_owned(),
58        _ => n,
59    }
60}