Skip to main content

SomeExecutorExt

Trait SomeExecutorExt 

Source
pub trait SomeExecutorExt: SomeExecutor + Clone { }
Expand description

A non-objsafe descendant of SomeExecutor.

This trait provides a more ergonomic interface for executors, but is not object-safe due to the Clone requirement. This is the preferred trait for most use cases where you know the executor type at compile time.

§Example

let task = Task::<_, Infallible>::without_notifications(
    "example".to_string(),
    Default::default(),
    async { 42 }
);
let observer = exec.spawn(task);
// Type-safe observer for the return value

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§