Struct choreographer::engine::Action [−][src]
pub struct Action<R> { /* fields omitted */ }
Expand description
A single behavior step
An Action is a single describable step in a sequence of events.
- Each
Action
consists of:- A
Context
, which contains information like the color, start time, and duration of an Action - A behavior, which is what the LED will do over time
- A
LoopBehavior
, which describes whether the individual Action will repeat in some way
- A
Actions are typically constructed through either the
ActionBuilder
or script!()
macro.
Actions are not usually interacted with directly, but rather
as part of a Sequence
.
Example
Creating an array of Action
s and setting each one to a different color:
use choreographer::colors::{RED, YELLOW, GREEN, CYAN, BLUE, MAGENTA}; use groundhog::std_timer::Timer; type MicroTimer = Timer<1_000_000>; let colors = [RED, YELLOW, GREEN, CYAN, BLUE, MAGENTA]; let mut actions: [Action<MicroTimer>; 6] = Default::default(); for (action, color) in actions.iter_mut().zip(colors.iter()) { *action = ActionBuilder::new().once().seek().color(*color).for_ms(100).finish(); }
Implementations
Return an ActionBuilder structure to configure a new Action
Trait Implementations
Auto Trait Implementations
impl<R> RefUnwindSafe for Action<R> where
R: RefUnwindSafe,
impl<R> UnwindSafe for Action<R> where
R: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more