Enum foxbox_taxonomy::values::OnOff [] [src]

pub enum OnOff {
    On,
    Off,
}

An on/off state.

JSON

This kind is represented by strings "On" | "Off".

Variants

On

JSON

Represented 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

JSON

Represented 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

fn into(self) -> Value

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

fn cmp(&self, other: &Self) -> Ordering

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);

fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer

impl Deserialize for OnOff

fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> where D: Deserializer

Derived Implementations

impl PartialEq for OnOff

fn eq(&self, __arg_0: &OnOff) -> bool

fn ne(&self, __arg_0: &OnOff) -> bool

impl Eq for OnOff

impl Clone for OnOff

fn clone(&self) -> OnOff

1.0.0fn clone_from(&mut self, source: &Self)

impl Debug for OnOff

fn fmt(&self, __arg_0: &mut Formatter) -> Result