windows_gen 0.18.0

Code generation for the windows crate
Documentation
use super::*;

pub fn to_ident(name: &str) -> Ident {
    // keywords list based on https://doc.rust-lang.org/reference/keywords.html
    match name {
        "abstract" | "as" | "become" | "box" | "break" | "const" | "continue" | "crate" | "do"
        | "else" | "enum" | "extern" | "false" | "final" | "fn" | "for" | "if" | "impl" | "in"
        | "let" | "loop" | "macro" | "match" | "mod" | "move" | "mut" | "override" | "priv"
        | "pub" | "ref" | "return" | "static" | "struct" | "super" | "trait" | "true" | "type"
        | "typeof" | "unsafe" | "unsized" | "use" | "virtual" | "where" | "while" | "yield"
        | "try" | "async" | "await" | "dyn" => format_ident!("r#{}", name),
        "Self" | "self" => format_ident!("{}_", name),
        "_" => format_ident!("unused"),
        _ => format_ident!("{}", name),
    }
}

pub fn to_abi_ident(name: &str) -> Ident {
    format_ident!("{}_abi", name)
}