rs2ts
v0.0.5
Published
generate ts interface from rust
Downloads
23
Readme
RUST TO TYPESCRIPT
create ts interface define from rust struct (serde)
from rust
#[derive(Serialize,Default)]
pub struct Connect<T> {
index: usize,
source: String,
target: String,
list: Vec<T>,
}
#[derive(Serialize)]
pub struct Cons2{
pub source_ip: Vec<String>,
pub count: u16,
}
to ts
export interface IConnect<T> {
index: number;
source: string;
target: string;
list: T[];
}
export interface ICons2 {
source_ip: string[];
count: number;
}
install
npm install rs2ts -g
usage
rs2ts -i ../demo/common.rs -o ./target/cm.ts
rs2ts --help