[][src]Module genco::lang::go

Specialization for Go code generation.

Examples

Basic example:

use genco::prelude::*;

let toks: js::Tokens = quote! {
    function foo(v) {
        return v + ", World";
    }

    foo("Hello");
};

assert_eq!(
    vec![
        "function foo(v) {",
        "    return v + \", World\";",
        "}",
        "",
        "foo(\"Hello\");",
    ],
    toks.to_file_vec()?
);

String quoting in JavaScript:

use genco::prelude::*;

let toks: go::Tokens = quote!("start π 😊 \n \x7f end");
assert_eq!("\"start \\u03c0 \\U0001f60a \\n \\x7f end\"", toks.to_string()?);

Structs

Config

Config data for Go.

Format

Format for Go.

Go

Language specialization for Go.

Import

The import of a Go type import "foo/bar".

Enums

Any

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

Traits

AsAny

Language-specific conversion trait implemented by all language items.

Functions

import

The import of a Go type import "foo/bar".

Type Definitions

Tokens

Tokens container specialization for Go.