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

Method block_on

crates/execution/node/src/node.rs:1169–1175  ·  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

1167
1168 /// Runs a future on the current runtime, or creates one when needed.
1169 pub fn block_on<T>(f: impl Future<Output = T>) -> T {
1170 if let Ok(runtime) = tokio::runtime::Handle::try_current() {
1171 tokio::task::block_in_place(|| runtime.block_on(f))
1172 } else {
1173 tokio::runtime::Runtime::new().unwrap().block_on(f)
1174 }
1175 }
1176}
1177
1178/// Base-specific discovery configuration.

Calls

no outgoing calls