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

Method block_on

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

1090
1091 /// Runs a future on the current runtime, or creates one when needed.
1092 pub fn block_on<T>(f: impl Future<Output = T>) -> T {
1093 if let Ok(runtime) = tokio::runtime::Handle::try_current() {
1094 tokio::task::block_in_place(|| runtime.block_on(f))
1095 } else {
1096 tokio::runtime::Runtime::new().unwrap().block_on(f)
1097 }
1098 }
1099}
1100
1101/// Base-specific discovery configuration.

Calls

no outgoing calls