Skip to main content

Crate bitwarden_ffi_macro

Crate bitwarden_ffi_macro 

Source
Expand description

Proc macros for FFI bindings (WASM, UniFFI).

Provides:

  • #[wasm_export] attribute macro for an impl block or free function exported to JavaScript.
  • #[wasm_record] attribute macro for a type that crosses the ABI through serde.
  • #[wasm_object] attribute macro for a type that crosses the ABI as a handle.

Each macro replaces the attribute it stands in for rather than decorating it, so an item carries one of these and no #[wasm_bindgen] or #[tsify] of its own. That is what lets the expansion change without touching call sites.

An expansion names only bitwarden_ffi, so a call site imports nothing โ€” but the crate has to forward its own wasm feature to bitwarden-ffi/wasm, which is where those names live.

Modulesยง

attrs ๐Ÿ”’
wasm_export ๐Ÿ”’
wasm_object ๐Ÿ”’
wasm_record ๐Ÿ”’

Attribute Macrosยง

wasm_export
Exports an impl block or a free function to JavaScript, in place of #[cfg_attr(feature = "wasm", wasm_bindgen(..))].
wasm_object
Declares a type that crosses the wasm ABI as an opaque handle, in place of #[cfg_attr(feature = "wasm", wasm_bindgen(..))] on a struct or an enum.
wasm_record
Declares a type that crosses the wasm ABI through serde, in place of #[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))].