Crate go_away[][src]

Expand description

Go Away

Go Away is a small library for generating go types & marshalling code from Rust type definitions. It’s intended for use when you have existing rust code that is using serde for JSON serialization and you want to allow go services or clients to interact with that code.

It may be expanded to other languages at some point but it’s mostly been built to service a very specific need and might never evolve past that.

Use is fairly simple:

use go_away::{TypeMetadata, TypeRegistry};

// First, derive TypeMetadata on some types:

struct MyType {
    my_field: String

// Then you can register this type inside a `TypeRegistry`

let mut registry = TypeRegistry::new();
MyType::metadata(&mut registry);

// And get some go code to write out to a file:
let go_code = go_away::registry_to_output::<go_away::GoType>(&registry);

Note that the output go code does not contain any package definitions or required imports. It’s expected that any code that calls go-away will add this for itself.


Defines the type model for go-away - a set of structs that describe types and can be used to generate copies of them in other languages.


A type identifier - used to deduplicate types in the output

A registry of type details.


An enum representing the possible top-level types in Golang

An enum representing the possible top-level types in TypeScript


A trait for types that can be registered as aliases.

Exposes metadata about a type that can be used to generate other versions of that type in other languages.


Generates code for all the types in the TypeRegistry

Derive Macros

Derives TypeMetadata for a given struct.