Trait OffloaderComponent

Source
pub trait OffloaderComponent:
    Debug
    + Send
    + Sync
    + 'static {
    // Required method
    fn offload<F>(&self, fut: F) -> SendBoxFuture<F::Item, F::Error>
       where F: Future + Send + 'static,
             F::Item: Send + 'static,
             F::Error: Send + 'static;
}
Expand description

Trait needed to be implemented for providing the offloading parts to a CompositeContext.

Required Methods§

Source

fn offload<F>(&self, fut: F) -> SendBoxFuture<F::Item, F::Error>
where F: Future + Send + 'static, F::Item: Send + 'static, F::Error: Send + 'static,

Calls to Context::offload and Context::offload_fn will be forwarded to this method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl OffloaderComponent for CpuPool

Source§

fn offload<F>(&self, fut: F) -> SendBoxFuture<F::Item, F::Error>
where F: Future + Send + 'static, F::Item: Send + 'static, F::Error: Send + 'static,

executes the futures fut “elswhere” e.g. in a cpu pool

Implementors§

Source§

impl<C> OffloaderComponent for C
where C: Context,

Allows using a part of an context as an component.