MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / call_post_return

Function call_post_return

crates/wasmtime/src/runtime/component/func.rs:705–733  ·  view source on GitHub ↗
(
    mut store: impl AsContextMut,
    func: Option<NonNull<VMFuncRef>>,
    arg: ValRaw,
    mut flags: InstanceFlags,
)

Source from the content-addressed store, hash-verified

703}
704
705pub(crate) unsafe fn call_post_return(
706 mut store: impl AsContextMut,
707 func: Option<NonNull<VMFuncRef>>,
708 arg: ValRaw,
709 mut flags: InstanceFlags,
710) -> Result<()> {
711 unsafe {
712 // Post return functions are forbidden from calling imports or
713 // intrinsics.
714 flags.set_may_leave(false);
715
716 // If the function actually had a `post-return` configured in its
717 // canonical options that's executed here.
718 if let Some(func) = func {
719 crate::Func::call_unchecked_raw(
720 &mut store.as_context_mut(),
721 func,
722 core::slice::from_ref(&arg).into(),
723 )?;
724 }
725
726 // And finally if everything completed successfully then the "may
727 // leave" flags is set to `true` again here which enables further
728 // use of the component.
729 flags.set_may_leave(true);
730 }
731
732 Ok(())
733}

Callers 2

post_return_implMethod · 0.85
queue_callMethod · 0.85

Calls 3

OkFunction · 0.85
set_may_leaveMethod · 0.80
as_context_mutMethod · 0.45

Tested by

no test coverage detected