This crate provides a futures executor whose only dependency is
To make https://docs.rs/ happy, this crate uses
std by default. For use
on embedded systems, disable default features and enable the
[dependencies.embedded-executor] version = "0.2.2" default-features = false features = ["alloc"]
SpinSleep provides a simple spinlock-based
implementation, and an example spinlock
RawMutex can be found in the
lock_api docs. It is recommended, however, to use implementations more
suited to your particular platform, such as a
Sleep that calls
cortex_m::asm::wfi and a
RawMutex that disables/enables interrupts.
Once you have all of these pieces, it's usually easiest to create an alias for your platform-specific executor:
type Executor<'a> = AllocExecutor<'a, IFreeMutex, WFISleep>;
which can then be instantiated via its
Futures can be spawned either by calling
AllocExecutor::spawn or by
alloc_executor::Spawner and calling
Spawner can also be passed to
Futures for even more spawning goodness.
Running the executor is done via the
AllocExecutor::run method. This
will drive all spawned futures and any new futures that get spawned to
completion before returning.
Simple atomic spinlock sleep implementation.
Platform-agnostic Sleep trait