Skip to main content

StaticExecutorExt

Trait StaticExecutorExt 

Source
pub trait StaticExecutorExt: SomeStaticExecutor + Clone { }
Expand description

A non-objsafe descendant of SomeStaticExecutor.

This trait provides a more ergonomic interface for static executors, but is not object-safe due to the Clone requirement. Static executors handle futures with ’static lifetime but without the Send requirement.

§Example

// Can use 'static but !Send types
let task = Task::<_, Infallible>::without_notifications(
    "example".to_string(),
    Default::default(),
    async { 42 }
);
let observer = exec.spawn_static(task);

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.

Implementors§