20 releases (13 stable)

1.10.0-beta.6 Jun 28, 2024
1.10.0-beta.4 May 28, 2024
1.8.0 Feb 28, 2024
1.7.0 Aug 11, 2023
1.0.0 Nov 22, 2022

#1327 in Command line utilities

Download history 219/week @ 2024-03-25 659/week @ 2024-04-01 247/week @ 2024-04-08 702/week @ 2024-04-15 355/week @ 2024-04-22 437/week @ 2024-04-29 266/week @ 2024-05-06 438/week @ 2024-05-13 376/week @ 2024-05-20 376/week @ 2024-05-27 403/week @ 2024-06-03 609/week @ 2024-06-10 364/week @ 2024-06-17 419/week @ 2024-06-24 350/week @ 2024-07-01 513/week @ 2024-07-08

1,688 downloads per month

MIT/Apache

425KB
12K SLoC

Rust 6K SLoC // 0.0% comments Swift 2K SLoC // 0.0% comments Go 1.5K SLoC // 0.0% comments Scala 819 SLoC // 0.1% comments Kotlin 797 SLoC // 0.1% comments TypeScript 351 SLoC // 0.1% comments

typeshare

CLI built on top of typeshare-core. Generate code in different languages from Rust type definitions for FFI interop.

Usage

cargo install typeshare
typeshare --lang=typescript some/file.rs
typeshare --lang=swift some/file.rs
typeshare --lang=kotlin --java-package=com.some.package.name some/file.rs
typeshare --lang=scala --scala-package=com.some.package.name some/file.rs

Generating FFI bindings

Include the typeshare annotation to generate a FFI binding for that function. Available languages are kotlin and swift.

#[typeshare(kotlin = "generateTotp", swift = "generate_totp")]
pub fn generate_totp(request: TotpGeneratorRequest) -> Result<TotpGeneratorResponse>`

Until the build system is changed to generate bindings during a build, it must be done manually and committed into the repo. FFI bindings are generated into the ffi/src/generated.rs file.

To generate all FFI bindings run make ffi. When adding or removing FFI bindings, don't forget to include the changes in the Makefile.

Dependencies

~7–17MB
~212K SLoC