[][src]Enum simple_xmlrpc::Value

pub enum Value {
    Int(i32),
    Int64(i64),
    Bool(bool),
    String(String),
    Double(f64),
    DateTime(DateTime),
    Base64(Vec<u8>),
    Struct(BTreeMap<String, Value>),
    Array(Vec<Value>),
    Nil,
}

Variants

Int(i32)

A 32-bit signed integer (<i4> or <int>).

Int64(i64)

A 64-bit signed integer (<i8>).

Bool(bool)

A boolean value (<boolean>, 0 == false, 1 == true).

String(String)

A string (<string>).

Double(f64)

A double-precision IEEE 754 floating point number (<double>).

DateTime(DateTime)

An ISO 8601 formatted date/time value (<dateTime.iso8601>).

Base64(Vec<u8>)

Base64-encoded binary data (<base64>).

A mapping of named values (<struct>).

Array(Vec<Value>)

A list of arbitrary (heterogeneous) values (<array>).

Nil

The empty (Unit) value (<nil/>).

Methods

impl Value[src]

pub fn stringify(&self) -> Result<String>[src]

pub fn as_i32(&self) -> Option<i32>[src]

Returns an inner struct or array value indexed by index.

Returns None if the member doesn't exist or self is neither a struct nor an array.

You can also use Rust's square-bracket indexing syntax to perform this operation if you want a default value instead of an Option. Refer to the top-level examples for details. If the Value is a normal integer (Value::Int), returns associated value. Returns None otherwise.

In particular, None is also returned if self is a Value::Int64. Use as_i64 to handle this case.

pub fn as_i64(&self) -> Option<i64>[src]

If the Value is an integer, returns associated value. Returns None otherwise.

This works with both Value::Int and Value::Int64.

pub fn as_bool(&self) -> Option<bool>[src]

If the Value is a boolean, returns associated value. Returns None otherwise.

pub fn as_str(&self) -> Option<&str>[src]

If the Value is a string, returns associated value. Returns None otherwise.

pub fn as_f64(&self) -> Option<f64>[src]

If the Value is a floating point number, returns associated value. Returns None otherwise.

pub fn as_datetime(&self) -> Option<DateTime>[src]

If the Value is a date/time, returns associated value. Returns None otherwise.

pub fn as_bytes(&self) -> Option<&[u8]>[src]

If the Value is base64 binary data, returns associated value. Returns None otherwise.

pub fn as_struct(&self) -> Option<&BTreeMap<String, Value>>[src]

If the Value is a struct, returns associated map. Returns None otherwise.

pub fn as_array(&self) -> Option<&[Value]>[src]

If the Value is an array, returns associated slice. Returns None otherwise.

Trait Implementations

impl Clone for Value[src]

impl Debug for Value[src]

impl<'_> From<&'_ str> for Value[src]

impl From<BTreeMap<String, Value>> for Value[src]

impl From<DateTime> for Value[src]

impl From<String> for Value[src]

impl From<Vec<Value>> for Value[src]

impl From<Vec<u8>> for Value[src]

impl From<bool> for Value[src]

impl From<f64> for Value[src]

impl From<i32> for Value[src]

impl From<i64> for Value[src]

impl PartialEq<Value> for Value[src]

impl StructuralPartialEq for Value[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.