Skip to main content

Crate bitwarden_ffi

Crate bitwarden_ffi 

Source
Expand description

Utilities for FFI bindings (WASM, UniFFI).

Re-exports proc macros from bitwarden-ffi-macro, plus the types the code they generate refers to. FromWasm and ToWasm explain how a type crosses the wasm ABI, and a LargeVec parameter converts a JavaScript array item by item as it is read.

Re-exports§

pub use large_vec::LargeVec;
pub use large_vec::LargeVecError;

Modules§

large_vec
LargeVec, a list parameter converted from JavaScript item by item as it is read, and its iterator.
wire 🔒
How a type crosses the wasm ABI.
wire_macros 🔒
The impl_wire_* macros, which implement the wire traits.

Macros§

impl_wire_object
Implements both traits for a type that crosses as itself: a #[wasm_bindgen] handle, an extern "C" type, or a primitive wasm_bindgen already understands.
impl_wire_record
Implements the traits for a serde DTO, which crosses as Ts<Self>.
impl_wire_string
Implements the traits for a type that crosses as a String, so a malformed string is a WireError::Parse rather than a throw from inside FromWasmAbi.

Structs§

Ts
A wrapper for a type implementing [Tsify], to be used in #[wasm_bindgen] function parameters and return types.

Enums§

Never
Stands in for the error of a shim whose underlying method cannot fail.
TsError
Error of a generated shim.
WireError
A value could not be converted across the wasm ABI.

Traits§

FromWasm
A type that can be received from JavaScript, crossing the ABI as Self::Wire.
ToWasm
A type that can be handed to JavaScript, crossing the ABI as Self::Wire.

Attribute Macros§

wasm_export
Exports an impl block or a free function to JavaScript, in place of #[cfg_attr(feature = "wasm", wasm_bindgen(..))].
wasm_import
Declares a block of JavaScript imports, in place of #[wasm_bindgen] on an extern "C" block.
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, as Ts<Self>.