28 releases (stable)

1.13.4 Dec 11, 2025
1.13.3 Jun 10, 2025
1.13.2 Nov 21, 2024
1.10.0-beta.7 Jul 23, 2024
1.0.0 Nov 22, 2022

#75 in FFI

Download history 565/week @ 2025-12-28 1060/week @ 2026-01-04 1106/week @ 2026-01-11 1243/week @ 2026-01-18 1367/week @ 2026-01-25 1682/week @ 2026-02-01 1859/week @ 2026-02-08 2659/week @ 2026-02-15 2245/week @ 2026-02-22 1908/week @ 2026-03-01 2613/week @ 2026-03-08 2149/week @ 2026-03-15 2004/week @ 2026-03-22 1892/week @ 2026-03-29 1642/week @ 2026-04-05 1632/week @ 2026-04-12

7,266 downloads per month

MIT/Apache

560KB
15K SLoC

Rust 8K SLoC // 0.0% comments Swift 2K SLoC // 0.0% comments Go 2K SLoC // 0.0% comments Kotlin 899 SLoC // 0.1% comments Scala 892 SLoC // 0.1% comments Python 652 SLoC // 0.2% comments TypeScript 431 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

~10–17MB
~327K SLoC