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

Function one_poll

crates/wasmtime/src/runtime/vm.rs:481–487  ·  view source on GitHub ↗

Attempts one poll of `f` to see if its output is available. This function is intended for a few minor entrypoints into the Wasmtime API where a synchronous function is documented to work even when `async_support` is enabled. For example growing a `Memory` can be done with a synchronous function, but it's documented to panic with an async resource limiter. This function provides the opportunity t

(f: F)

Source from the content-addressed store, hash-verified

479/// message should be generated recommending to use an async function (e.g.
480/// `grow_async` instead of `grow`).
481fn one_poll<F: Future>(f: F) -> Option<F::Output> {
482 let mut context = Context::from_waker(&Waker::noop());
483 match pin!(f).poll(&mut context) {
484 Poll::Ready(output) => Some(output),
485 Poll::Pending => None,
486 }
487}

Callers 1

assert_readyFunction · 0.85

Calls 1

pollMethod · 0.45

Tested by

no test coverage detected