Enum rmpv::ValueRef
[−]
[src]
pub enum ValueRef<'a> { Nil, Boolean(bool), U64(u64), I64(i64), F32(f32), F64(f64), String(&'a str), Binary(&'a [u8]), Array(Vec<ValueRef<'a>>), Map(Vec<(ValueRef<'a>, ValueRef<'a>)>), Ext(i8, &'a [u8]), }
Variants
Nil
Nil represents nil.
Boolean(bool)
Boolean represents true or false.
U64(u64)
Unsigned integer.
I64(i64)
Signed integer.
F32(f32)
A 32-bit floating point number.
F64(f64)
A 64-bit floating point number.
String(&'a str)
String extending Raw type represents a UTF-8 string.
Binary(&'a [u8])
Binary extending Raw type represents a byte array.
Array(Vec<ValueRef<'a>>)
Array represents a sequence of objects.
Map(Vec<(ValueRef<'a>, ValueRef<'a>)>)
Map represents key-value pairs of objects.
Ext(i8, &'a [u8])
Extended implements Extension interface: represents a tuple of type information and a byte array where type information is an integer whose meaning is defined by applications.
Methods
impl<'a> ValueRef<'a>
[src]
fn to_owned(&self) -> Value
Converts the current non-owning value to an owned Value.
This is achieved by deep copying all underlying structures and borrowed buffers.
Panics
Panics in unable to allocate memory to keep all internal structures and buffers.
Examples
use rmpv::{Value, ValueRef}; let val = ValueRef::Array(vec![ ValueRef::Nil, ValueRef::U64(42), ValueRef::Array(vec![ ValueRef::String("le message"), ]) ]); let expected = Value::Array(vec![ Value::Nil, Value::U64(42), Value::Array(vec![ Value::String("le message".to_string()) ]) ]); assert_eq!(expected, val.to_owned());
Trait Implementations
impl<'a> Clone for ValueRef<'a>
[src]
fn clone(&self) -> ValueRef<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more