pub enum ColorParseError {
Show 21 variants NoHue, NonNumericHue(ParseIntError), NoSaturation, NonNumericSaturation(ParseFloatError), NoBrightness, NonNumericBrightness(ParseFloatError), NoKelvin, NonNumericKelvin(ParseIntError), WeirdHsbkComponent(Color), MultipleHues, MultipleSaturations, MultipleBrightnesses, MultipleKelvins, NoRed, NonNumericRed(ParseIntError), NoGreen, NonNumericGreen(ParseIntError), NoBlue, NonNumericBlue(ParseIntError), ShortString, LongString,
}
Expand description

Represents an error encountered while deserializing a color.

Variants

NoHue

No hue was given.

Example
use lifxi::http::prelude::*;
let color = "hue:".parse::<Color>();
assert_eq!(color, Err(ColorParseError::NoHue));

NonNumericHue(ParseIntError)

The hue could not be parsed as an integer.

Example
use lifxi::http::prelude::*;
let color = "hue:j".parse::<Color>();
assert!(color.is_err());

NoSaturation

No saturation was given.

Example
use lifxi::http::prelude::*;
let color = "saturation:".parse::<Color>();
assert_eq!(color, Err(ColorParseError::NoSaturation));

NonNumericSaturation(ParseFloatError)

The saturation could not be parsed as a float.

Example
use lifxi::http::prelude::*;
let color = "saturation:j".parse::<Color>();
assert!(color.is_err());

NoBrightness

No brightness was given.

Example
use lifxi::http::prelude::*;
let color = "brightness:".parse::<Color>();
assert_eq!(color, Err(ColorParseError::NoBrightness));

NonNumericBrightness(ParseFloatError)

The brightness could not be parsed as a float.

Example
use lifxi::http::prelude::*;
let color = "brightness:j".parse::<Color>();
assert!(color.is_err());

NoKelvin

No color temperature was given.

Example
use lifxi::http::prelude::*;
let color = "kelvin:".parse::<Color>();
assert_eq!(color, Err(ColorParseError::NoKelvin));

NonNumericKelvin(ParseIntError)

The color temperature could not be parsed as an integer.

Example
use lifxi::http::prelude::*;
let color = "kelvin:j".parse::<Color>();
assert!(color.is_err());

WeirdHsbkComponent(Color)

When parsing our way through what looked like an HSBK color, we found another color.

Example
use lifxi::http::prelude::*;
let color = "hue:100 rgb:0,0,0".parse::<Color>();
assert!(color.is_err());

MultipleHues

Multiple hues were specified.

use lifxi::http::prelude::*;
let color = "hue:100 hue:100".parse::<Color>();
assert_eq!(color, Err(ColorParseError::MultipleHues));

MultipleSaturations

Multiple hues were specified.

use lifxi::http::prelude::*;
let color = "saturation:100 saturation:100".parse::<Color>();
assert_eq!(color, Err(ColorParseError::MultipleSaturations));

MultipleBrightnesses

Multiple hues were specified.

use lifxi::http::prelude::*;
let color = "brightness:0.4 brightness:0.4".parse::<Color>();
assert_eq!(color, Err(ColorParseError::MultipleBrightnesses));

MultipleKelvins

Multiple hues were specified.

use lifxi::http::prelude::*;
let color = "kelvin:2000 kelvin:2000".parse::<Color>();
assert_eq!(color, Err(ColorParseError::MultipleKelvins));

NoRed

No red component was given.

Example
use lifxi::http::prelude::*;
let color = "rgb:".parse::<Color>();
assert_eq!(color, Err(ColorParseError::NoRed));

NonNumericRed(ParseIntError)

The red component could not be parsed as an integer.

Example
use lifxi::http::prelude::*;
let color = "rgb:j".parse::<Color>();
assert!(color.is_err());

NoGreen

No green component was given.

Example
use lifxi::http::prelude::*;
let color = "rgb:0,".parse::<Color>();
assert_eq!(color, Err(ColorParseError::NoGreen));

NonNumericGreen(ParseIntError)

The green component could not be parsed as an integer.

Example
use lifxi::http::prelude::*;
let color = "rgb:0,j".parse::<Color>();
assert!(color.is_err());

NoBlue

No blue component was given.

Example
use lifxi::http::prelude::*;
let color = "rgb:0,1,".parse::<Color>();
assert_eq!(color, Err(ColorParseError::NoBlue));

NonNumericBlue(ParseIntError)

The blue component could not be parsed as an integer.

Example
use lifxi::http::prelude::*;
let color = "rgb:0,1,j".parse::<Color>();
assert!(color.is_err());

ShortString

The string is too short to be an RGB string and was not recognized as a keyword.

Example
use lifxi::http::prelude::*;
let color = "foo".parse::<Color>();
assert_eq!(color, Err(ColorParseError::ShortString));

LongString

The string is too long to be an RGB string and was not recognized as a keyword.

Example
use lifxi::http::prelude::*;
let color = "foobarbaz".parse::<Color>();
assert_eq!(color, Err(ColorParseError::LongString));

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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
Converts the given value to a String. 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.