ruskit 0.1.5

A modern web framework for Rust inspired by Laravel
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fs;
use ts_rs::ExportError;

pub struct TsExporter {
    pub export_fn: fn() -> Result<String, ExportError>,
}

inventory::collect!(TsExporter);

pub fn export_all_types(output_file: &str) -> Result<(), ExportError> {
    let types: Vec<String> = inventory::iter::<TsExporter>
        .into_iter()
        .filter_map(|exporter| (exporter.export_fn)().ok())
        .collect();

    fs::write(output_file, types.join("\n"))?;
    Ok(())
}