Files
wasmeld/components/echo/src/lib.rs
T

25 lines
640 B
Rust
Raw Normal View History

//! Smallest request/response Component example: it returns input bytes unchanged.
mod bindings {
// Generate the guest trait and export adapter from the selected WIT world.
// Dependency sync must populate `wit/deps` before this macro is compiled.
wit_bindgen::generate!({
path: "wit",
world: "echo-component",
});
}
struct Echo;
impl bindings::Guest for Echo {
fn init(_config: Vec<u8>) -> Result<(), bindings::ServiceError> {
Ok(())
}
fn invoke(input: Vec<u8>) -> Result<Vec<u8>, bindings::ServiceError> {
Ok(input)
}
}
bindings::export!(Echo with_types_in bindings);