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

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 Actions 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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.