[][src]Module genco::prelude::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:

use genco::prelude::*;

let toks: rust::Tokens = quote!(#("hello \n world".quoted()));
assert_eq!("\"hello \\n world\"", toks.to_string()?);

Structs

Config

Language configuration for Rust.

Format

Format state for Rust.

Ref

The inferred reference.

Rust

Language specialization for Rust.

StaticRef

The static reference.

Type

An imported name in Rust.

Enums

Import

The import policy to use when generating import statements.

Reference

Reference information about a name.

Constants

I8

The i8 type.

I16

The i16 type.

I32

The i32 type.

I64

The i64 type.

I128

The i128 type.

ISIZE

The isize type.

NEVER

The ! (never) type.

U8

The u8 type.

U16

The u16 type.

U32

The u32 type.

U64

The u64 type.

U128

The u128 type.

UNIT

The () (unit) type.

USIZE

The usize type.

Traits

Args

Helper trait for things that can be turned into generic arguments.

Functions

const_local

Helper function to construct a constant local type.

imported

Setup an imported element.

local

Setup a local element.

Type Definitions

LangBox

Language box specialization for Rust.

Tokens

Tokens container specialization for Rust.