preserves-schema 5.996.0

Implementation of Preserves Schema code generation and support for Rust.
Documentation
// Rust keywords.

use lazy_static::lazy_static;
use preserves::value::Set;

lazy_static! {
    /// All Rust keywords.
    /// See https://doc.rust-lang.org/reference/keywords.html
    static ref RUST_KEYWORDS: Set<&'static str> = vec![
        "as",
        "break",
        "const",
        "continue",
        "crate",
        "else",
        "enum",
        "extern",
        "false",
        "fn",
        "for",
        "if",
        "impl",
        "in",
        "let",
        "loop",
        "match",
        "mod",
        "move",
        "mut",
        "pub",
        "ref",
        "return",
        "self",
        "Self",
        "static",
        "struct",
        "super",
        "trait",
        "true",
        "type",
        "unsafe",
        "use",
        "where",
        "while",

        "async",
        "await",
        "dyn",

        "abstract",
        "become",
        "box",
        "do",
        "final",
        "macro",
        "override",
        "priv",
        "typeof",
        "unsized",
        "virtual",
        "yield",

        "try",

        "macro_rules",
        "union",
        "static",
    ].into_iter().collect();
}

pub fn escape_kw(s: String) -> String {
    if RUST_KEYWORDS.contains(s.as_str()) {
        s + "_"
    } else {
        s
    }
}