[][src]Module genco::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().unwrap()
);

String quoting in JavaScript:

use genco::prelude::*;

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

Structs

Array

An array []<inner>.

Config

Config data for Go.

Go

Language specialization for Go.

Interface

The interface type interface{}.

Map

A map map[<key>]<value>.

Type

A Go type.

TypeBox

Boxed type container

Enums

TypeEnum

Enum that can be used for casting between variants of the same type

Constants

INTERFACE

The interface type interface{}.

Traits

Args

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

TypeTrait

Trait implemented by all types

Functions

array

Setup an array.

imported

Setup an imported element.

local

Setup a local element.

map

Setup a map.

Type Definitions

Tokens

Tokens container specialization for Go.