17 releases (stable)

1.10.0-beta.1 May 2, 2024
1.9.2 Apr 16, 2024
1.8.0 Feb 28, 2024
1.7.0 Aug 11, 2023
1.0.0 Nov 22, 2022

#1159 in Command line utilities

Download history 137/week @ 2024-01-23 209/week @ 2024-01-30 244/week @ 2024-02-06 241/week @ 2024-02-13 162/week @ 2024-02-20 419/week @ 2024-02-27 271/week @ 2024-03-05 324/week @ 2024-03-12 276/week @ 2024-03-19 217/week @ 2024-03-26 690/week @ 2024-04-02 228/week @ 2024-04-09 736/week @ 2024-04-16 336/week @ 2024-04-23 415/week @ 2024-04-30 236/week @ 2024-05-07

1,776 downloads per month

MIT/Apache

410KB
11K SLoC

Rust 6K SLoC // 0.0% comments Swift 2K SLoC // 0.0% comments Go 1.5K SLoC // 0.0% comments Scala 780 SLoC // 0.1% comments Kotlin 734 SLoC // 0.1% comments TypeScript 338 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
~213K SLoC