Enum foxbox_taxonomy::values::OnOff
[−]
[src]
pub enum OnOff { On, Off, }
Variants
On | JSONRepresented by "On". use foxbox_taxonomy::values::*; use foxbox_taxonomy::parse::*; use foxbox_taxonomy::serialize::*; let parsed = OnOff::from_str("\"On\"").unwrap(); assert_eq!(parsed, OnOff::On); let serialized: JSON = OnOff::On.to_json(&mut MultiPart::new()); assert_eq!(serialized.as_string().unwrap(), "On"); | |
Off | JSONRepresented by "Off". use foxbox_taxonomy::values::*; use foxbox_taxonomy::parse::*; use foxbox_taxonomy::serialize::*; let parsed = OnOff::from_str("\"On\"").unwrap(); assert_eq!(parsed, OnOff::On); let serialized: JSON = OnOff::On.to_json(&mut MultiPart::new()); assert_eq!(serialized.as_string().unwrap(), "On"); |
Trait Implementations
impl Parser<OnOff> for OnOff
fn description() -> String
fn parse(path: Path, source: &mut JSON) -> Result<Self, ParseError>
fn from_str(source: &str) -> Result<T, ParseError>
fn take(path: Path, source: &mut JSON, field_name: &str) -> Result<T, ParseError>
fn take_opt(path: Path, source: &mut JSON, field_name: &str) -> Option<Result<T, ParseError>>
fn take_vec_opt(path: Path, source: &mut JSON, field_name: &str) -> Option<Result<Vec<T>, ParseError>>
fn take_vec(path: Path, source: &mut JSON, field_name: &str) -> Result<Vec<T>, ParseError>
impl ToJSON for OnOff
fn to_json(&self, parts: &mut BinaryParts) -> JSON
impl Into<Value> for OnOff
impl PartialOrd for OnOff
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
1.0.0fn lt(&self, other: &Rhs) -> bool
1.0.0fn le(&self, other: &Rhs) -> bool
1.0.0fn gt(&self, other: &Rhs) -> bool
1.0.0fn ge(&self, other: &Rhs) -> bool
impl Ord for OnOff
impl Serialize for OnOff
(De)serialization
Values of this type are represented by strings "On" | "Off".
extern crate serde; extern crate serde_json; extern crate foxbox_taxonomy; let on = serde_json::to_string(&foxbox_taxonomy::values::OnOff::On).unwrap(); assert_eq!(on, "\"On\""); let on : foxbox_taxonomy::values::OnOff = serde_json::from_str("\"On\"").unwrap(); assert_eq!(on, foxbox_taxonomy::values::OnOff::On); let off = serde_json::to_string(&foxbox_taxonomy::values::OnOff::Off).unwrap(); assert_eq!(off, "\"Off\""); let off : foxbox_taxonomy::values::OnOff = serde_json::from_str("\"Off\"").unwrap(); assert_eq!(off, foxbox_taxonomy::values::OnOff::Off);