pub struct State {
pub power: Option<String>,
pub color: Option<String>,
pub brightness: Option<f64>,
pub duration: Option<f64>,
pub infrared: Option<f64>,
pub selector: Option<String>,
pub fast: Option<bool>,
}
Expand description
Used to descripe the state of an LIFX Light Source
Fields§
§power: Option<String>
The power state you want to set on the selector. on or off
color: Option<String>
The color to set the light to.
brightness: Option<f64>
The brightness level from 0.0 to 1.0. Overrides any brightness set in color (if any).
duration: Option<f64>
How long in seconds you want the power action to take. Range: 0.0 – 3155760000.0 (100 years)
infrared: Option<f64>
The maximum brightness of the infrared channel from 0.0 to 1.0.
selector: Option<String>
The selector to limit which light to use for set_states()
fast: Option<bool>
Execute the query fast, without initial state checks and wait for no results.
Implementations§
Source§impl State
impl State
Sourcepub fn new() -> Self
pub fn new() -> Self
Returns a new State object
§Examples
extern crate lifx_rs as lifx;
fn main() {
let key = "xxx".to_string();
let mut api_endpoints: Vec<String> = Vec::new();
api_endpoints.push(format!("https://api.lifx.com"));
api_endpoints.push(format!("http://localhost:8089"));
let config = lifx::LifxConfig{
access_token: key.clone(),
api_endpoints: api_endpoints
};
let mut state = lifx::State::new();
state.power = Some(format!("off"));
}
Trait Implementations§
Source§impl<'de> Deserialize<'de> for State
impl<'de> Deserialize<'de> for State
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for State
Auto Trait Implementations§
impl Freeze for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more