Tags: irstavr/mangotyp
Tags
use clap to enforce required args by user It forces the user to define both a input filename (Rust) and an output filename (Typescript). Also it helps to know the available commands via Rust CLI.
parse tokens - add support for i32->number The Integer32 in our type will be captured with the ident value. we are only focusing on our simple type for the time being and ignoring all other matches If any type that our utility does not know how to process is encountered, the dbg! macro will print a message along with a convenient line number so user's can easily identify which condition was hit and expand on the utility if they choose. All of Rust's many different types of numbers will simply be treated as a number when deserialized as Typescript` refactor - add support for integers 32
add support for enums we minimize our case to enums with attributes `#[serde(tag = "test", content = "result")]`
read the contents of our Rust file read input Rust file and crete a syn::File with it we read the file's contents by using the std lib, File, Read and Path then parse it into a syn::File where we can iterate over the contents of the file in a typesafe manner.
parse tokens and convert them into strings of text that conform to Typescript's syntax rules
add support for tuples e.g. [i32, i32] Tuples are a common data type in Rust that roughly correspond to array types in Typescript where each element has a specific type (so a tuple like (i32, i32) for example would be translated to [number, number] rather than the less specific number[] that vectors would translate into.)
refactor main - split read and write of files in diff funcs