Struct lifxi::http::ChangeState
source · pub struct ChangeState<'a, T: Select> { /* private fields */ }
Expand description
A scoped request to uniformly change the state for all selected bulbs.
Example
use lifxi::http::prelude::*;
let client = Client::new("foo");
let result = client
.select(Selector::All)
.change_state()
.power(true)
.hue(-10)
.saturation(0.1)
.brightness(0.4)
.kelvin(100)
.transition(::std::time::Duration::new(7, 0))
.infrared(-0.1)
.send();
Implementations
sourceimpl<'a, T: Select> ChangeState<'a, T>
impl<'a, T: Select> ChangeState<'a, T>
sourcepub fn power<P: Into<Power>>(&mut self, on: P) -> &mut Self
pub fn power<P: Into<Power>>(&mut self, on: P) -> &mut Self
Sets target power state.
Example
use lifxi::http::prelude::*;
let client = Client::new("foo");
let result = client
.select(Selector::All)
.change_state()
.power(true)
.brightness(-0.3)
.send();
sourcepub fn transition<D: Into<Duration>>(&mut self, duration: D) -> &mut Self
pub fn transition<D: Into<Duration>>(&mut self, duration: D) -> &mut Self
Sets transition duration.
Example
use lifxi::http::prelude::*;
let client = Client::new("foo");
let result = client
.select(Selector::All)
.change_state()
.power(true)
.transition(::std::time::Duration::new(7, 0))
.send();
sourcepub fn hue(&mut self, hue: i16) -> &mut Self
pub fn hue(&mut self, hue: i16) -> &mut Self
Sets change in hue.
Example
use lifxi::http::prelude::*;
let client = Client::new("foo");
let result = client
.select(Selector::All)
.change_state()
.power(true)
.hue(-10)
.send();
sourcepub fn saturation(&mut self, saturation: f32) -> &mut Self
pub fn saturation(&mut self, saturation: f32) -> &mut Self
Sets change in saturation.
Example
use lifxi::http::prelude::*;
let client = Client::new("foo");
let result = client
.select(Selector::All)
.change_state()
.power(true)
.saturation(0.1)
.send();
sourcepub fn brightness(&mut self, brightness: f32) -> &mut Self
pub fn brightness(&mut self, brightness: f32) -> &mut Self
Sets change in brightness.
Example
use lifxi::http::prelude::*;
let client = Client::new("foo");
let result = client
.select(Selector::All)
.change_state()
.brightness(-0.2)
.send();
Trait Implementations
sourceimpl<'a, T: Select> AsRequest<StateChange> for ChangeState<'a, T>
impl<'a, T: Select> AsRequest<StateChange> for ChangeState<'a, T>
sourcefn body(&self) -> &StateChange
fn body(&self) -> &StateChange
The request body to be used, as configured by the user.
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for ChangeState<'a, T>
impl<'a, T> Send for ChangeState<'a, T>where
T: Sync,
impl<'a, T> Sync for ChangeState<'a, T>where
T: Sync,
impl<'a, T> Unpin for ChangeState<'a, T>
impl<'a, T> !UnwindSafe for ChangeState<'a, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more