Skip to main content

guest_function

Attribute Macro guest_function 

Source
#[guest_function]
Expand description

Register a guest function under a compile-time fn_id.

use nub_host_guest_macro::guest_function;

#[guest_function(fn_id = 1)]
pub fn nub_invoke(input: &[u8]) -> Vec<u8> {
    // ...
}

Expands to the original function plus a linkme distributed-slice entry that the guestbin’s dispatch function iterates at call time. The function signature is fixed: fn(&[u8]) -> Vec<u8>.