[][src]Enum cjdns_admin::ReturnValue

pub enum ReturnValue {
    Int(i64),
    String(String),
    List(Vec<ReturnValue>),
    Map(BTreeMap<String, ReturnValue>),
}

Remote function return value. Supports json-like data types.

Variants

Int(i64)

Integer return value.

String(String)

String return value.

List(Vec<ReturnValue>)

List return value.

Map(BTreeMap<String, ReturnValue>)

Map return value.

Implementations

impl ReturnValue[src]

pub fn as_int(&self) -> Result<i64, ()>[src]

Access stored Int value.

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

Access stored String value.

pub fn as_list<'rv, T, F>(&'rv self, item_convert: F) -> Result<Vec<T>, ()> where
    F: FnMut(&'rv ReturnValue) -> Result<T, ()>, 
[src]

Access stored List value, converting each list element. Returns a new Vec where each element is converted from another ReturnValue to the appropriate type.

pub fn as_map<'rv, T, F>(
    &'rv self,
    value_convert: F
) -> Result<BTreeMap<String, T>, ()> where
    F: FnMut(&'rv ReturnValue) -> Result<T, ()>, 
[src]

Access stored Map value, converting each entry value element. Returns a new BTreeMap where each key is String and each value is converted from another ReturnValue to the appropriate type.

pub fn as_int_list(&self) -> Result<Vec<i64>, ()>[src]

Access stored List value. Returns a new Vec where each element is converted to i64.

pub fn as_int_map(&self) -> Result<BTreeMap<String, i64>, ()>[src]

Access stored Map<String, Int> value. Returns a new BTreeMap where each key is String and each value is converted to i64.

Trait Implementations

impl Clone for ReturnValue[src]

impl Debug for ReturnValue[src]

impl<'de> Deserialize<'de> for ReturnValue[src]

impl Eq for ReturnValue[src]

impl PartialEq<ReturnValue> for ReturnValue[src]

impl StructuralEq for ReturnValue[src]

impl StructuralPartialEq for ReturnValue[src]

Auto Trait Implementations

impl RefUnwindSafe for ReturnValue

impl Send for ReturnValue

impl Sync for ReturnValue

impl Unpin for ReturnValue

impl UnwindSafe for ReturnValue

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,