Enum rmp::value::ValueRef [] [src]

pub enum ValueRef<'a> {
    Nil,
    Boolean(bool),
    Integer(Integer),
    Float(Float),
    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.

Integer(Integer)

Integer represents an integer.

Float(Float)

Float represents a 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 rmp::{Value, ValueRef};
use rmp::value::Integer;

let val = ValueRef::Array(vec![
   ValueRef::Nil,
   ValueRef::Integer(Integer::U64(42)),
   ValueRef::Array(vec![
       ValueRef::String("le message"),
   ])
]);

let expected = Value::Array(vec![
    Value::Nil,
    Value::Integer(Integer::U64(42)),
    Value::Array(vec![
        Value::String("le message".to_string())
    ])
]);

assert_eq!(expected, val.to_owned());

Trait Implementations

impl<'a> PartialEq for ValueRef<'a>
[src]

fn eq(&self, __arg_0: &ValueRef<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &ValueRef<'a>) -> bool

This method tests for !=.

impl<'a> Debug for ValueRef<'a>
[src]

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

Formats the value using the given formatter.

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