pub struct StepFuture<Driver, Timer, const TIMER_HZ: u32> { /* private fields */ }Expand description
The “future” returned by Stepper::step
Please note that this type provides a custom API and does not implement
core::future::Future. This might change, when using futures for embedded
development becomes more practical.
Implementations§
Source§impl<Driver, Timer, const TIMER_HZ: u32> StepFuture<Driver, Timer, TIMER_HZ>where
Driver: Step,
Timer: TimerTrait<TIMER_HZ>,
impl<Driver, Timer, const TIMER_HZ: u32> StepFuture<Driver, Timer, TIMER_HZ>where
Driver: Step,
Timer: TimerTrait<TIMER_HZ>,
Sourcepub fn new(driver: Driver, timer: Timer) -> Self
pub fn new(driver: Driver, timer: Timer) -> Self
Create new instance of StepFuture
This constructor is public to provide maximum flexibility for
non-standard use cases. Most users can ignore this and just use
Stepper::step instead.
Sourcepub fn poll(
&mut self,
) -> Poll<Result<(), SignalError<Driver::Error, <Driver::Step as ErrorType>::Error, Timer::Error>>>
pub fn poll( &mut self, ) -> Poll<Result<(), SignalError<Driver::Error, <Driver::Step as ErrorType>::Error, Timer::Error>>>
Poll the future
The future must be polled for the operation to make progress. The
operation won’t start, until this method has been called once. Returns
Poll::Pending, if the operation is not finished yet, or
Poll::Ready, once it is.
If this method returns Poll::Pending, the user can opt to keep
calling it at a high frequency (see Self::wait) until the operation
completes, or set up an interrupt that fires once the timer finishes
counting down, and call this method again once it does.
Sourcepub fn wait(
&mut self,
) -> Result<(), SignalError<Driver::Error, <Driver::Step as ErrorType>::Error, Timer::Error>>
pub fn wait( &mut self, ) -> Result<(), SignalError<Driver::Error, <Driver::Step as ErrorType>::Error, Timer::Error>>
Wait until the operation completes
This method will call Self::poll in a busy loop until the operation
has finished.
Sourcepub fn release(self) -> (Driver, Timer)
pub fn release(self) -> (Driver, Timer)
Drop the future and release the resources that were moved into it