bincode-typescript 0.1.0

Generates TypeScript serialisation and deserialisation code from Rust structs and enums
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use bincode_typescript::from_string;
use std::{
    error::Error,
    fs::{self},
};

fn main() -> Result<(), Box<dyn Error>> {
    let args: Vec<String> = std::env::args().collect();
    let buffer_support = args.contains(&"--buffer-support".to_string());
    let input = args.last().expect("Could not find input file name");

    let rust = fs::read_to_string(input)?;
    println!("{}", from_string(&rust, buffer_support)?);

    Ok(())
}