[−][src]Struct embedded_executor::alloc_executor::AllocExecutor
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
.
Implementations
impl<'a, R, S> AllocExecutor<'a, R, S> where
R: RawMutex,
S: Sleep + Wake + Clone + Default,
[src]
R: RawMutex,
S: Sleep + Wake + Clone + Default,
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 Future
s
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 Future
s
pub fn spawn_raw<F>(&mut self, future: F) where
F: UnsafeFutureObj<'a, ()>,
[src]
F: UnsafeFutureObj<'a, ()>,
Spawn a local UnsafeFutureObj
into the executor.
pub fn spawn<F>(&mut self, future: F) where
F: Future<Output = ()> + 'a,
[src]
F: Future<Output = ()> + 'a,
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.
Trait Implementations
impl<'a, R, S> Default for AllocExecutor<'a, R, S> where
R: RawMutex,
S: Sleep + Wake + Clone + Default,
[src]
R: RawMutex,
S: Sleep + Wake + Clone + Default,
Auto Trait Implementations
impl<'a, R, S> !Send for AllocExecutor<'a, R, S>
impl<'a, R, S> !Sync for AllocExecutor<'a, R, S>
impl<'a, R, S> Unpin for AllocExecutor<'a, R, S> where
S: Unpin,
S: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,