#[host_function]Expand description
Attribute macro to mark a function as a host function. This will generate a function that calls the host function with the same name.
If a name is provided as an argument, that name will be used to call the host function. Otherwise, the function’s identifier will be used.
The function arguments must be supported parameter types, and the return type must be
a supported return type or a Result<T, HyperlightGuestError> with T being a supported
return type.
§Panic
If the return type is not a Result, the generated function will panic if the host function returns an error.
§Example
ⓘ
use hyperlight_guest_bin::host_function;
#[host_function]
fn my_host_function(arg1: i32, arg2: String) -> i32;or with a custom name:
ⓘ
use hyperlight_guest_bin::host_function;
#[host_function("custom_name")]
fn my_host_function(arg1: i32, arg2: String) -> i32;or with a Result return type:
ⓘ
use hyperlight_guest_bin::host_function;
use hyperlight_guest::error::HyperlightGuestError;
#[host_function]
fn my_host_function(arg1: i32, arg2: String) -> Result<i32, HyperlightGuestError>;