Crates.io | typeshare-cli |
lib.rs | typeshare-cli |
version | 1.13.2 |
source | src |
created_at | 2022-11-22 06:40:15.885848 |
updated_at | 2024-11-21 18:13:41.454337 |
description | Command Line Tool for generating language files with typeshare |
homepage | |
repository | https://github.com/1Password/typeshare |
max_upload_size | |
id | 720640 |
size | 56,052 |
CLI built on top of typeshare-core
. Generate code in different languages from Rust type definitions for FFI interop.
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
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
.