[−][src]Struct aimc_hal::automation::All
A combinator which combines many AutomationSequences and will poll them
all to completion, stopping when either a fault is raised or there are no
more incomplete sequences.
Examples
use aimc_hal::automation::{AutomationSequence, Transition, All}; /// A simple automation sequence which will return `Transition::Incomplete` /// until it reaches zero. struct CountDown(usize); impl<I, O> AutomationSequence<I, O> for CountDown { type FaultInfo = (); fn poll(&mut self, inputs: &I, outputs: &mut O) -> Transition<()> { if self.0 == 0 { Transition::Complete } else { self.0 -= 1; Transition::Incomplete } } } // Combine the sequences into one big automation sequence let mut seq = All::new([CountDown(1), CountDown(5), CountDown(2)]); // we'll keep track of the number of polls let mut polls = 0; // keep polling until all the timers have reached zero while seq.poll(&(), &mut ()) != Transition::Complete { polls += 1; } // we should have polled 5 times (`max(1, 5, 2)`) assert_eq!(polls, 5);
Implementations
impl<A, const N: usize> All<A, { N }>[src]
Trait Implementations
impl<I, O, A, const N: usize> AutomationSequence<I, O> for All<A, { N }> where
A: AutomationSequence<I, O>, [src]
A: AutomationSequence<I, O>,
type FaultInfo = A::FaultInfo
Extra info attached to a fault.
fn poll(&mut self, inputs: &I, outputs: &mut O) -> Transition<Self::FaultInfo>[src]
impl<A, const N: usize> Clone for All<A, { N }> where
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: Clone, [src]
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: Clone,
impl<A, const N: usize> Copy for All<A, { N }> where
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: Copy, [src]
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: Copy,
impl<A, const N: usize> Debug for All<A, { N }> where
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: Debug, [src]
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: Debug,
impl<A, const N: usize> Default for All<A, { N }> where
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: Default, [src]
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: Default,
impl<A, const N: usize> PartialEq<All<A, N>> for All<A, { N }> where
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: PartialEq, [src]
[Option<A>; N]: LengthAtMost32,
[Option<A>; N]: PartialEq,
Auto Trait Implementations
impl<const N: usize, A> RefUnwindSafe for All<A, N> where
A: RefUnwindSafe,
A: RefUnwindSafe,
impl<const N: usize, A> Send for All<A, N> where
A: Send,
A: Send,
impl<const N: usize, A> Sync for All<A, N> where
A: Sync,
A: Sync,
impl<const N: usize, A> Unpin for All<A, N> where
A: Unpin,
A: Unpin,
impl<const N: usize, A> UnwindSafe for All<A, N> where
A: UnwindSafe,
A: UnwindSafe,
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,
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> Same<T> for T[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
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.
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>,