Enum foxbox_taxonomy::values::OpenClosed [] [src]

pub enum OpenClosed {
    Open,
    Closed,
}

An open/closed state.

JSON

Values of this type are represented by strings "Open" | "Closed".

Variants

Open

JSON

Represented by "Open".

use foxbox_taxonomy::values::*;
use foxbox_taxonomy::parse::*;
use foxbox_taxonomy::serialize::*;

let parsed = OpenClosed::from_str("\"Open\"").unwrap();
assert_eq!(parsed, OpenClosed::Open);

let serialized: JSON = OpenClosed::Open.to_json(&mut MultiPart::new());
assert_eq!(serialized.as_string().unwrap(), "Open");
Closed

JSON

Represented by "Closed".

use foxbox_taxonomy::values::*;
use foxbox_taxonomy::parse::*;
use foxbox_taxonomy::serialize::*;

let parsed = OpenClosed::from_str("\"Closed\"").unwrap();
assert_eq!(parsed, OpenClosed::Closed);

let serialized: JSON = OpenClosed::Closed.to_json(&mut MultiPart::new());
assert_eq!(serialized.as_string().unwrap(), "Closed");

Trait Implementations

impl Parser<OpenClosed> for OpenClosed

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 OpenClosed

fn to_json(&self, parts: &mut BinaryParts) -> JSON

impl Into<Value> for OpenClosed

fn into(self) -> Value

impl PartialOrd for OpenClosed

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 OpenClosed

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

impl Serialize for OpenClosed

(De)serialization

Values of this state are represented by strings "Open"|"Closed".

extern crate serde;
extern crate serde_json;
extern crate foxbox_taxonomy;

let open = serde_json::to_string(&foxbox_taxonomy::values::OpenClosed::Open).unwrap();
assert_eq!(open, "\"Open\"");

let open : foxbox_taxonomy::values::OpenClosed = serde_json::from_str("\"Open\"").unwrap();
assert_eq!(open, foxbox_taxonomy::values::OpenClosed::Open);

let closed = serde_json::to_string(&foxbox_taxonomy::values::OpenClosed::Closed).unwrap();
assert_eq!(closed, "\"Closed\"");

let closed : foxbox_taxonomy::values::OpenClosed = serde_json::from_str("\"Closed\"").unwrap();
assert_eq!(closed, foxbox_taxonomy::values::OpenClosed::Closed);

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

impl Deserialize for OpenClosed

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

Derived Implementations

impl PartialEq for OpenClosed

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

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

impl Eq for OpenClosed

impl Clone for OpenClosed

fn clone(&self) -> OpenClosed

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

impl Debug for OpenClosed

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