[][src]Module genco::lang::rust

Specialization for Rust code generation.

Examples

use genco::prelude::*;

let toks: rust::Tokens = quote! {
    fn foo() -> u32 {
        42
    }
};

assert_eq!(
    vec![
        "fn foo() -> u32 {",
        "    42",
        "}",
    ],
    toks.to_file_vec()?
);

String Quoting in Rust

Rust uses UTF-8 internally, string quoting is with the exception of escape sequences a one-to-one translation.

use genco::prelude::*;

let toks: rust::Tokens = quote!("start π 😊 \n \x7f ÿ $ end");
assert_eq!("\"start π 😊 \\n \\x7f ÿ $ end\"", toks.to_string()?);

Structs

Config

Language configuration for Rust.

Format

Format state for Rust.

Import

The import of a Rust name use std::collections::HashMap.

Rust

Language specialization for Rust.

Enums

Any

Enum produced by AsAny::as_any() which can be used to identify and operate over a discrete language item type.

ImportMode

The import policy to use when generating import statements.

Traits

AsAny

Language-specific conversion trait implemented by all language items.

Functions

import

Setup an imported element.

Type Definitions

Tokens

Tokens container specialization for Rust.