[][src]Struct embedded_executor::alloc_executor::AllocExecutor

pub struct AllocExecutor<'a, R, S> where
    R: RawMutex + Send + Sync,
    S: Sleep
{ /* fields omitted */ }

Alloc-only Future executor

Assuming the RawMutex implementation provided is sound, this should be safe to use in both embedded and non-embedded scenarios. On embedded devices, it will probably be a type that disables/re-enables interrupts. On real OS's, it can be an actual mutex implementation.

The Sleep implementation can be used to put the event loop into a low-power state using something like cortex_m::wfi/e.

Methods

impl<'a, R, S> AllocExecutor<'a, R, S> where
    R: RawMutex + Send + Sync + 'static,
    S: Sleep
[src]

pub fn new() -> Self
[src]

Initialize a new AllocExecutor

Does nothing unless it's run()

pub fn with_capacity(registry: usize, queue: usize) -> Self
[src]

Initialize a new AllocExecutor with the given capacities.

Does nothing unless it's run()

pub fn spawner(&self) -> Spawner<'a, R>
[src]

Get a handle to a Spawner that can be passed to Future constructors to spawn even more Futures

pub fn local_spawner(&self) -> LocalSpawner<'a, R>
[src]

Get a handle to a LocalSpawner that can be passed to local Future constructors to spawn even more local Futures

pub fn spawn_raw<F>(&mut self, future: F) where
    F: UnsafeFutureObj<'a, ()>, 
[src]

Spawn a local UnsafeFutureObj into the executor.

pub fn spawn<F>(&mut self, future: F) where
    F: Future<Output = ()> + 'a, 
[src]

Spawn a Future into the executor.

This will implicitly box the future in order to objectify it.

pub fn run(&mut self)
[src]

Run the executor

Each loop will poll at most one task from the queue and then check for newly spawned tasks. If there are no new tasks spawned and nothing left in the queue, the executor will attempt to sleep.

Once there's nothing to spawn and nothing left in the registry, the executor will return.

Auto Trait Implementations

impl<'a, R, S> !Send for AllocExecutor<'a, R, S>

impl<'a, R, S> !Sync for AllocExecutor<'a, R, S>

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]