go-away 0.5.0

Generates go types from rust types
Documentation

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:

#[derive(TypeMetadata)]
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.