pub struct Color {
pub hue: Option<f64>,
pub saturation: Option<f64>,
pub kelvin: Option<i64>,
pub brightness: Option<f64>,
pub error: Option<String>,
pub errors: Option<Vec<Error>>,
}
Expand description
Represents an LIFX Color
Fields§
§hue: Option<f64>
§saturation: Option<f64>
§kelvin: Option<i64>
§brightness: Option<f64>
§error: Option<String>
§errors: Option<Vec<Error>>
Implementations§
Source§impl Color
impl Color
Sourcepub async fn async_validate(
config: LifxConfig,
color: String,
) -> Result<Color, Error>
pub async fn async_validate( config: LifxConfig, color: String, ) -> Result<Color, Error>
Asynchronously validates a color
§Arguments
access_token
- A personal acces token for authentication with LIFX.
§Examples
extern crate lifx_rs as lifx;
#[tokio::main]
async 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 scenes = lifx::Color::async_validate(key, format!("red")).await?;
}
Sourcepub fn validate(config: LifxConfig, color: String) -> Result<Color, Error>
pub fn validate(config: LifxConfig, color: String) -> Result<Color, Error>
Validates a color
§Arguments
access_token
- A personal acces token for authentication with LIFX.
§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 scenes = lifx::Color::validate(config)?;
}
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
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 Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
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