MCPcopy Create free account
hub / github.com/base/base / block_on

Function block_on

crates/proof/proof/src/blocking_runtime.rs:8–16  ·  view source on GitHub ↗
(f: impl Future<Output = T>)

Source from the content-addressed store, hash-verified

6/// This function blocks on a future in place until it is ready.
7#[cfg(feature = "std")]
8pub fn block_on<T>(f: impl Future<Output = T>) -> T {
9 // When running with Tokio, use the appropriate blocking mechanism
10 if let Ok(runtime) = tokio::runtime::Handle::try_current() {
11 tokio::task::block_in_place(|| runtime.block_on(f))
12 } else {
13 // Fallback to tokio's block_on if we're not in a runtime
14 tokio::runtime::Runtime::new().unwrap().block_on(f)
15 }
16}
17
18/// This function busy waits on a future until it is ready. It uses a no-op waker to poll the future
19/// in a thread-blocking loop.

Callers 10

mainFunction · 0.85
trie_node_by_hashMethod · 0.85
trie_node_by_hashMethod · 0.85
bytecode_by_hashMethod · 0.85
header_by_hashMethod · 0.85
hint_trie_nodeMethod · 0.85
hint_account_proofMethod · 0.85
hint_storage_proofMethod · 0.85
network_configMethod · 0.85

Calls 4

noop_raw_wakerFunction · 0.85
block_onMethod · 0.80
as_mutMethod · 0.80
pollMethod · 0.45

Tested by

no test coverage detected