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

Function block_on

crates/fuzzing/src/lib.rs:54–67  ·  view source on GitHub ↗
(future: F)

Source from the content-addressed store, hash-verified

52}
53
54fn block_on<F: Future>(future: F) -> F::Output {
55 const MAX_POLLS: u32 = 100_000;
56
57 let mut f = Box::pin(future);
58 let mut cx = Context::from_waker(Waker::noop());
59 for _ in 0..MAX_POLLS {
60 match f.as_mut().poll(&mut cx) {
61 Poll::Ready(val) => return val,
62 Poll::Pending => {}
63 }
64 }
65
66 panic!("future didn't become ready")
67}
68
69/// Helper future to yield N times before resolving.
70struct YieldN(u32);

Callers 8

call_asyncFunction · 0.70
testMethod · 0.70
fuzzMethod · 0.70
debugMethod · 0.50
fooMethod · 0.50
fooMethod · 0.50
static_api_testFunction · 0.50

Calls 2

pollMethod · 0.45
as_mutMethod · 0.45

Tested by

no test coverage detected