Enum msgpack_value::Value
source · pub enum Value {
Nil,
Bool(bool),
Int(Int),
F32(f32),
F64(f64),
Str(Str),
Bin(Bin),
Array(Vec<Value>),
Map(Vec<(Value, Value)>),
Ext(Ext),
}
Variants§
Nil
Bool(bool)
Int(Int)
F32(f32)
F64(f64)
Str(Str)
Bin(Bin)
Array(Vec<Value>)
Map(Vec<(Value, Value)>)
Ext(Ext)
Implementations§
source§impl Value
impl Value
pub fn is_nil(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_int(&self) -> bool
pub fn is_f32(&self) -> bool
pub fn is_f64(&self) -> bool
pub fn is_str(&self) -> bool
pub fn is_bin(&self) -> bool
pub fn is_array(&self) -> bool
pub fn is_map(&self) -> bool
pub fn is_ext(&self) -> bool
pub fn as_bool(&self) -> Option<bool>
pub fn as_int(&self) -> Option<Int>
pub fn as_f32(&self) -> Option<f32>
pub fn as_f64(&self) -> Option<f64>
pub fn as_str(&self) -> Option<&Str>
pub fn as_str_mut(&mut self) -> Option<&mut Str>
pub fn as_bin(&self) -> Option<&Bin>
pub fn as_bin_mut(&mut self) -> Option<&mut Bin>
pub fn as_array(&self) -> Option<&[Value]>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Value>>
pub fn as_map(&self) -> Option<&[(Value, Value)]>
pub fn as_map_mut(&mut self) -> Option<&mut Vec<(Value, Value)>>
pub fn as_ext(&self) -> Option<&Ext>
pub fn as_ext_mut(&mut self) -> Option<&mut Ext>
Trait Implementations§
source§impl Arbitrary for Value
impl Arbitrary for Value
§type Parameters = ()
type Parameters = ()
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = BoxedStrategy<Value>
type Strategy = BoxedStrategy<Value>
The type of
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_: Self::Parameters) -> Self::Strategy
source§impl<T> Index<T> for Valuewhere
T: Index,
impl<T> Index<T> for Valuewhere T: Index,
source§fn index(&self, index: T) -> &Self::Output
fn index(&self, index: T) -> &Self::Output
Accessing inner values of value
using indexing value[0]
or value["foo"]
.
Panics
This function panics when self
does not contain given key.
Duplicate keys
If self
is a map object and contains two or more keys matching against the given index,
indexing works as if the preceding keys do not exist in the object.
This is the same behaviour as what EMCA-262 specifies.
let v = msgpack!({ "a" : 0, "a" : 1 });
assert_eq!(v["a"], Int::from(1u32).into());
source§impl PartialEq<Value> for Value
impl PartialEq<Value> for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more