#[dispatch]Expand description
Attribute macro to mark a function as the dispatch function for the guest. This is the function that will be called by the host when a function call is made to a function that is not registered with the host.
§Example
ⓘ
use hyperlight_guest_bin::dispatch;
use hyperlight_guest::error::Result;
use hyperlight_guest::bail;
use hyperlight_common::flatbuffer_wrappers::function_call::FunctionCall;
use hyperlight_common::flatbuffer_wrappers::util::get_flatbuffer_result;
#[dispatch]
fn dispatch(fc: FunctionCall) -> Result<Vec<u8>> {
let name = &fc.function_name;
if name == "greet" {
return Ok(get_flatbuffer_result("Hello, world!"));
}
bail!("Unknown function: {name}");
}