Enum foxbox_taxonomy::values::OpenClosed
[−]
[src]
pub enum OpenClosed { Open, Closed, }
Variants
Open | JSONRepresented 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 | JSONRepresented 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
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
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);