26 releases (stable)

1.13.2 Nov 21, 2024
1.12.0 Oct 25, 2024
1.10.0-beta.7 Jul 23, 2024
1.8.0 Feb 28, 2024
1.0.0 Nov 22, 2022

#680 in Command line utilities

Download history 827/week @ 2024-09-24 692/week @ 2024-10-01 1231/week @ 2024-10-08 614/week @ 2024-10-15 859/week @ 2024-10-22 472/week @ 2024-10-29 712/week @ 2024-11-05 934/week @ 2024-11-12 978/week @ 2024-11-19 561/week @ 2024-11-26 663/week @ 2024-12-03 683/week @ 2024-12-10 476/week @ 2024-12-17 120/week @ 2024-12-24 277/week @ 2024-12-31 426/week @ 2025-01-07

1,395 downloads per month

MIT/Apache

455KB
12K SLoC

Rust 6.5K SLoC // 0.0% comments Swift 2K SLoC // 0.0% comments Go 1.5K SLoC // 0.0% comments Scala 853 SLoC // 0.1% comments Kotlin 846 SLoC // 0.1% comments TypeScript 375 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

~11–23MB
~332K SLoC