23 releases (15 stable)

new 1.12.0 Oct 25, 2024
1.10.0-beta.7 Jul 23, 2024
1.8.0 Feb 28, 2024
1.7.0 Aug 11, 2023
1.0.0 Nov 22, 2022

#772 in Command line utilities

Download history 536/week @ 2024-07-05 311/week @ 2024-07-12 341/week @ 2024-07-19 489/week @ 2024-07-26 240/week @ 2024-08-02 227/week @ 2024-08-09 225/week @ 2024-08-16 274/week @ 2024-08-23 435/week @ 2024-08-30 569/week @ 2024-09-06 647/week @ 2024-09-13 844/week @ 2024-09-20 717/week @ 2024-09-27 988/week @ 2024-10-04 983/week @ 2024-10-11 565/week @ 2024-10-18

3,348 downloads per month

MIT/Apache

450KB
12K SLoC

Rust 6.5K SLoC // 0.0% comments Swift 2K SLoC // 0.0% comments Go 1.5K SLoC // 0.0% comments Scala 842 SLoC // 0.1% comments Kotlin 838 SLoC // 0.1% comments TypeScript 370 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–22MB
~325K SLoC