Trait WireSpawn

Source
pub trait WireSpawn: Clone {
    type Error;
    type Info;

    // Required method
    fn info(&self) -> &Self::Info;
}
Expand description

A trait to assist in spawning a handler task

This trait is weird, and mostly exists to abstract over how “normal” async executors like tokio spawn tasks, taking a future, and how unusual async executors like embassy spawn tasks, taking a task token that maps to static storage

Required Associated Types§

Source

type Error

An error type returned when spawning fails. If this cannot happen, Infallible can be used.

Source

type Info

The context used for spawning a task.

For example, in tokio this is (), and in embassy this is Spawner.

Required Methods§

Source

fn info(&self) -> &Self::Info

Retrieve Self::Info

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§