wasmtime::component

Derive Macro Lift

Source
#[derive(Lift)]
{
    // Attributes available to this derive:
    #[component]
}
Available on crate features runtime and component-model only.
Expand description

A derive macro for generating implementations of the Lift trait.

This macro will likely be applied in conjunction with the #[derive(ComponentType)] macro along the lines of #[derive(ComponentType, Lift)]. This trait enables reading values from WebAssembly.

Note you might be looking for bindgen! rather than this macro as that will generate the entire type for you rather than just a trait implementation.

At this time this derive macro has no configuration.

ยงExamples

use wasmtime::component::{ComponentType, Lift};

#[derive(ComponentType, Lift)]
#[component(record)]
struct Color {
    r: u8,
    g: u8,
    b: u8,
}