Skip to main content

Executor

Trait Executor 

Source
pub trait Executor: Send + Sync {
    // Required method
    fn block_on<F, T>(&self, fut: F) -> T
       where F: Future<Output = T> + Send,
             T: Send;
}
Expand description

Drives an async future to completion synchronously. Pluggable so callers can choose between tokio, commonware-runtime’s deterministic runner (tests), or the planned production tokio runner without mkit-core having to compile-time depend on a specific runtime crate.

Implementations MUST be re-entrancy-safe in the sense expected by the chosen runtime — calling block_on from inside an already-running task on the same runtime will typically panic or deadlock. The shim’s contract is “synchronous external API wraps async internals”, not “arbitrary async-from-sync recursion”.

Required Methods§

Source

fn block_on<F, T>(&self, fut: F) -> T
where F: Future<Output = T> + Send, T: Send,

Block the current thread until fut resolves.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§