Struct lifxi::http::StateChange

source ·
pub struct StateChange {
    pub power: Option<Power>,
    pub duration: Option<Duration>,
    pub infrared: Option<f32>,
    pub hue: Option<i16>,
    pub saturation: Option<f32>,
    pub brightness: Option<f32>,
    pub kelvin: Option<i16>,
}
Expand description

Encodes a desired state change.

This struct is intended for use with Selected::change_state, and it is encouraged to use the builder methods instead of directly constructing a changeset.

Fields

power: Option<Power>

The desired power state.

duration: Option<Duration>

How long the transition should take.

infrared: Option<f32>

The desired change in infrared light level.

hue: Option<i16>

The desired change in hue.

saturation: Option<f32>

The desired change in saturation.

brightness: Option<f32>

The desired change in brightness.

kelvin: Option<i16>

The desired change in color temperature.

Implementations

Constructs an empty state change.

Identical to StateChange::new.

Creates a new builder.

Builder function to change target power state.

Example
use lifxi::http::StateChange;
let new: StateChange = StateChange::builder().power(true);

Builder function to change transition duration.

Example
use lifxi::http::StateChange;
let new: StateChange = StateChange::builder().transition(::std::time::Duration::from_secs(1));

Builder function to set target change in hue.

Example
use lifxi::http::StateChange;
let new: StateChange = StateChange::builder().hue(-60);

Builder function to set target change in saturation.

Example
use lifxi::http::StateChange;
let new: StateChange = StateChange::builder().saturation(-0.1);

Builder function to set target change in brightness.

Example
use lifxi::http::StateChange;
let new: StateChange = StateChange::builder().brightness(0.4);

Builder function to set target change in color temperature.

Example
use lifxi::http::StateChange;
let new: StateChange = StateChange::builder().kelvin(-200);

Trait Implementations

The HTTP verb to be used.
A reference to the shared client (so we can reuse it).
The relative path (to the API root) of the appropriate endpoint.
The request body to be used, as configured by the user.
The number of attempts to be made.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.