wasmtime::component

Derive Macro Lower

source
#[derive(Lower)]
{
    // 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 Lower trait.

This macro will likely be applied in conjunction with the #[derive(ComponentType)] macro along the lines of #[derive(ComponentType, Lower)]. This trait enables passing values to 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, Lower};

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