18 releases (stable)

6.0.1 Jun 6, 2022
5.0.0 Feb 18, 2022
4.0.0 Feb 18, 2022
3.0.0 Feb 5, 2022
0.0.0 Sep 19, 2020
Download history 167/week @ 2023-01-22 231/week @ 2023-01-29 232/week @ 2023-02-05 312/week @ 2023-02-12 259/week @ 2023-02-19 180/week @ 2023-02-26 123/week @ 2023-03-05 101/week @ 2023-03-12 70/week @ 2023-03-19 231/week @ 2023-03-26 181/week @ 2023-04-02 212/week @ 2023-04-09 121/week @ 2023-04-16 159/week @ 2023-04-23 227/week @ 2023-04-30 153/week @ 2023-05-07

685 downloads per month

MIT license

2.5K SLoC

Crates.io Docs.rs Rust CI


Gull is a tool that takes abstract static type definitions and generates static types definitions into multiple languages. Currently supported languages: Rust, Hack (PHP), Flow (unstable)

The core assumption is that serializing this type to JSON in any language produces a JSON string that can be safely parsed into the same type in another language.

The goal is to generate user friendly types that can be used in application logic directly. It also copies all associated documentation for each type or struct field to every single destination target.

NOTE: This is not an RPC framework and does not support any kind of message passing. It only generates types and fully relies on languages implementations of JSON serialization while being agnostic to how these strings are passed between environments. Resulting JSON strings can be passed through a tmp file on a filesystem, intermediate storage in a database, STDIO, JSON string over http or any other RPC protocols (e.g. Thrift) or any other methods.


use gull::prelude::*;
use k9::snapshot;

let mut declarations = Declarations::new();

declarations.add(TypeDeclaration {
name: "Frame",
docs: "Frame represents a tuple of an Timestamp (RFC3339) and an ID",
config: vec![TypeDeclarationConfig::RustAttribute("#[derive(Copy, Clone)]")],
generic_params: vec![],
value: DeclarationValue::TTuple(TTuple {
items: vec![

#[derive(Copy, Clone)]
/// Frame represents a tuple of an Timestamp (RFC3339) and an ID
pub type Frame = (String, i64);


// Frame represents a tuple of an Timestamp (RFC3339) and an ID
type Frame = (string, int);

// Frame represents a tuple of an Timestamp (RFC3339) and an ID
export type Frame = [string, number];

for more examples see gull/e2e/basic_codegen_test.rs

These types can be safely passed across the boundaries when de\serialized to and from JSON.

// In rust
use generated_types::Frame;
let thing: Frame = ("2020-01-01:00:00:00Z", 1);
let json = serde_json::to_string(&thing).unwrap();
write_to_file("/tmp/my_thing.json", &json);

// in JS
import type {Frame} from './generated_types.js';
const getFrame = (file_path: string): Frame => {
return JSON.parse(read_file(file_path));
const json: Frame = getFrame("/tmp/my_thing.json");


~60K SLoC