11 stable releases

1.8.0 Feb 28, 2024
1.7.0 Aug 11, 2023
1.6.0 May 12, 2023
1.5.0 Apr 13, 2023
1.0.0 Nov 22, 2022

#774 in Command line utilities

Download history 268/week @ 2023-11-20 195/week @ 2023-11-27 242/week @ 2023-12-04 175/week @ 2023-12-11 123/week @ 2023-12-18 43/week @ 2023-12-25 135/week @ 2024-01-01 166/week @ 2024-01-08 248/week @ 2024-01-15 142/week @ 2024-01-22 180/week @ 2024-01-29 273/week @ 2024-02-05 204/week @ 2024-02-12 198/week @ 2024-02-19 418/week @ 2024-02-26 261/week @ 2024-03-04

1,091 downloads per month

MIT/Apache

365KB
10K SLoC

Rust 4.5K SLoC // 0.0% comments Swift 2K SLoC // 0.0% comments Go 1.5K SLoC // 0.0% comments Kotlin 785 SLoC // 0.1% comments Scala 779 SLoC // 0.1% comments TypeScript 337 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–9.5MB
~167K SLoC