Enum keyvalues_parser::Value [−][src]
Expand description
Variants
Tuple Fields of Obj
0: Obj<'a>Implementations
Gets the inner &mut str if this is a Value::Str
Gets the inner &mut Obj if this is a Value::Obj
Unwraps the Cow<str> from the Value::Str
Panics
If the variant was Value::Obj
Examples
use keyvalues_parser::Value; use std::borrow::Cow; let value = Value::Str(Cow::from("Sample text")); assert_eq!(value.unwrap_str(), "Sample text");
use keyvalues_parser::Value; use std::collections::BTreeMap; let value = Value::Obj(BTreeMap::new()); value.unwrap_str(); // <-- panics
Unwraps the Obj from the Value::Obj
Panics
If the variant was Value::Str
Examples
use keyvalues_parser::Value; use std::collections::BTreeMap; let empty_map = BTreeMap::new(); let value = Value::Obj(empty_map.clone()); assert_eq!(value.unwrap_obj(), empty_map);
use keyvalues_parser::Value; use std::borrow::Cow; let value = Value::Str(Cow::from("D'Oh")); value.unwrap_obj(); // <-- panics
Refer to Value::unwrap_str. Same situation, but with a custom message
Refer to Value::unwrap_obj. Same situation, but with a custom message
Trait Implementations
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for Value<'a>
impl<'a> UnwindSafe for Value<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more