Skip to content

Tags: irstavr/mangotyp

Tags

use-clap-read-cli

Toggle use-clap-read-cli's commit message
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.

support-i32

Toggle support-i32's commit message
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

support-enums

Toggle support-enums's commit message
add support for enums

we minimize our case to enums with attributes `#[serde(tag = "test", content = "result")]`

refactor-code

Toggle refactor-code's commit message
refactor code into separate files

read-file

Toggle read-file's commit message
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-to-strings

Toggle parse-tokens-to-strings's commit message
parse tokens and convert them into strings of text

that conform to Typescript's syntax rules

install-tools

Toggle install-tools's commit message
ignore generated ts rules file

add-tuples

Toggle add-tuples's commit message
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.)

add-structs

Toggle add-structs's commit message
add support for structs

refactor structs

add-std-types

Toggle add-std-types's commit message
refactor main - split read and write of files in diff funcs