bitwarden_ffi/lib.rs
1//! Utilities for FFI bindings (WASM, UniFFI).
2//!
3//! Re-exports proc macros from `bitwarden-ffi-macro`, plus the types the code they generate refers
4//! to. [`FromWasm`] and [`ToWasm`] explain how a type crosses the wasm ABI, and a [`LargeVec`]
5//! parameter converts a JavaScript array item by item as it is read.
6
7pub mod large_vec;
8#[cfg(feature = "wasm")]
9mod wire;
10mod wire_macros;
11
12pub use bitwarden_ffi_macro::{wasm_export, wasm_import, wasm_object, wasm_record};
13pub use large_vec::{LargeVec, LargeVecError};
14// `Ts` appears in hand-written `extern "C"` signatures, so it is named outside an expansion
15// and belongs in the public surface.
16#[cfg(feature = "wasm")]
17pub use tsify::Ts;
18#[cfg(feature = "wasm")]
19pub use wire::{FromWasm, Never, ToWasm, TsError, WireError};
20#[cfg(feature = "wasm")]
21#[doc(hidden)]
22pub use wire::{format_wire_string, import_conversion_error, parse_wire_string};
23
24/// What the macro expansions name, so a call site imports nothing and names only this crate.
25///
26/// Not a public API.
27#[cfg(feature = "wasm")]
28#[doc(hidden)]
29pub mod _macro {
30 pub use ::wasm_bindgen::{self, prelude::wasm_bindgen};
31 pub use tsify::Tsify;
32}