Struct lifxi::http::Cycle

source ·
pub struct Cycle<'a, T: Select> { /* private fields */ }
Expand description

Specifies a list of effects to cycle through. Each request causes the cycle to advance.

Example

use lifxi::http::prelude::*;
fn client() -> Client {
    // TODO: Add lazy-static dependency and use it to make a shared client.
    unimplemented!()
}
// Let's make a light show we can advance by pressing a button!
// Each press of our internet-connected button calls this function.
fn next() {
    let red = State::builder().color(Color::Red);
    let green = State::builder().color(Color::Green);
    let white = State::builder().color(Color::White);
    let shared = State::builder().color(Color::Brightness(1.0)).power(true);
    let result = client()
        .select(Selector::All)
        .cycle()
        .add(red)
        .add(green)
        .add(white)
        .rev() // Let's mix it up a little!
        .default(shared)
        .send();
}

Implementations

Adds a state to the cycle.

Sets the default values to use when not specified.

Reverses the direction of the cycle.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.