Skip to main content

block_on_nautilus_with

Function block_on_nautilus_with 

Source
pub fn block_on_nautilus_with<C, F>(create_future: C) -> F::Output
where C: FnOnce() -> F + Send, F: Future, F::Output: Send,
Expand description

Constructs and blocks on a future using the global Nautilus runtime.

The factory runs after entering the Nautilus runtime so Tokio resources created by the operation bind to that runtime rather than an ambient caller runtime. Resources captured by the factory must not depend on the ambient runtime making progress.

Calls from a foreign Tokio runtime synchronously park the calling thread while the operation runs. Tokio does not expose whether a foreign runtime is polling a LocalSet, so this bridge cannot use block_in_place there without breaking supported LocalSet callers.

ยงPanics

Panics from a LocalSet driven on a Nautilus-owned thread. Tokio does not expose whether the current multi-thread runtime context is polling local tasks, so the bridge cannot both preserve scheduler progress with block_in_place and support that context. A LocalSet hosted by a foreign runtime, or driven from an external thread against the default Nautilus runtime, is supported. Same-runtime LocalSet calls are not supported with an injected runtime because its already-built runtime has no thread-ownership callbacks.