pub struct GuestFunctionRegister<F: Copy> { /* private fields */ }Expand description
Represents the functions that the guest exposes to the host.
Implementations§
Source§impl<F: Copy> GuestFunctionRegister<F>
impl<F: Copy> GuestFunctionRegister<F>
Sourcepub fn register(
&mut self,
guest_function: GuestFunctionDefinition<F>,
) -> Option<GuestFunctionDefinition<F>>
pub fn register( &mut self, guest_function: GuestFunctionDefinition<F>, ) -> Option<GuestFunctionDefinition<F>>
Register a new GuestFunctionDefinition into self.
If a function with the same name already exists, it will be replaced.
None is returned if the function name was not previously registered,
otherwise the previous GuestFunctionDefinition is returned.
Sourcepub fn get(&self, function_name: &str) -> Option<&GuestFunctionDefinition<F>>
pub fn get(&self, function_name: &str) -> Option<&GuestFunctionDefinition<F>>
Gets a GuestFunctionDefinition by its name field.
Source§impl GuestFunctionRegister<GuestFunc>
impl GuestFunctionRegister<GuestFunc>
pub fn register_fn<Output, Args>(
&mut self,
name: impl Into<String>,
f: impl AsGuestFunctionDefinition<Output, Args>,
)where
Args: ParameterTuple,
Output: SupportedReturnType,
Trait Implementations§
Source§impl<F: Clone + Copy> Clone for GuestFunctionRegister<F>
impl<F: Clone + Copy> Clone for GuestFunctionRegister<F>
Source§fn clone(&self) -> GuestFunctionRegister<F>
fn clone(&self) -> GuestFunctionRegister<F>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<F> Freeze for GuestFunctionRegister<F>
impl<F> RefUnwindSafe for GuestFunctionRegister<F>where
F: RefUnwindSafe,
impl<F> Send for GuestFunctionRegister<F>where
F: Send,
impl<F> Sync for GuestFunctionRegister<F>where
F: Sync,
impl<F> Unpin for GuestFunctionRegister<F>
impl<F> UnsafeUnpin for GuestFunctionRegister<F>
impl<F> UnwindSafe for GuestFunctionRegister<F>where
F: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more