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

Method block_on

crates/execution/node/src/node.rs:1220–1226  ·  view source on GitHub ↗

Runs a future on the current runtime, or creates one when needed.

(f: impl Future<Output = T>)

Source from the content-addressed store, hash-verified

1218
1219 /// Runs a future on the current runtime, or creates one when needed.
1220 pub fn block_on<T>(f: impl Future<Output = T>) -> T {
1221 if let Ok(runtime) = tokio::runtime::Handle::try_current() {
1222 tokio::task::block_in_place(|| runtime.block_on(f))
1223 } else {
1224 tokio::runtime::Runtime::new().unwrap().block_on(f)
1225 }
1226 }
1227}
1228
1229/// Base-specific discovery configuration.

Calls 1

newFunction · 0.50