Skip to main content

RuntimeExt

Trait RuntimeExt 

Source
pub trait RuntimeExt: Runtime {
    // Provided methods
    fn spawn<F>(&self, future: F)
       where F: Future<Output = ()> + 'static { ... }
    fn core(&self, placement: impl Into<Placement>) -> OnCore<'_, Self> { ... }
    fn blocking<R, W>(&self, work: W) -> Blocking<'_, Self, W, R>
       where R: Send + 'static,
             W: FnOnce() -> Result<R, ProximaError> + Send + 'static { ... }
}
Expand description

Fluent spawn surface. Blanket-implemented for every Runtime; never used as dyn itself, which is what buys back the generics.

Provided Methods§

Source

fn spawn<F>(&self, future: F)
where F: Future<Output = ()> + 'static,

Spawn a future on the current core. The trait’s own spawn_on_current_core discards a SpawnError that spawn_on_core surfaces — this keeps that discard where the caller can see it.

Source

fn core(&self, placement: impl Into<Placement>) -> OnCore<'_, Self>

Bind the placement axis to a specific core. Terminal spawn then returns Result<(), SpawnError> rather than swallowing back-pressure.

Source

fn blocking<R, W>(&self, work: W) -> Blocking<'_, Self, W, R>
where R: Send + 'static, W: FnOnce() -> Result<R, ProximaError> + Send + 'static,

Bind the payload axis to work that occupies a thread. Nothing here blocks the caller: the terminal hands back a future.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<R: Runtime + ?Sized> RuntimeExt for R