Skip to main content

wasm_record

Attribute Macro wasm_record 

Source
#[wasm_record]
Expand description

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))].

#[serde(..)] and #[tsify(..)] attributes are left in place for Tsify’s derive to read, and the #[derive(..)] for Serialize / Deserialize / UniFFI stays where it is — this macro only owns the wasm side.

#[wasm_record(input)] declares only the JavaScript-to-Rust direction, for a type that must not be serialized back out (for example, one holding a password).

ⓘ
#[wasm_record]
#[derive(Serialize, Deserialize)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
#[serde(rename_all = "camelCase")]
pub struct CipherView { pub id: Option<CipherId> }