pub trait ValueAsContainer {
    type Array: Array;
    type Object: Object;

    // Required methods
    fn as_array(&self) -> Option<&Self::Array>;
    fn as_object(&self) -> Option<&Self::Object>;
}
Expand description

Trait to allow accessing data inside a Value

Required Associated Types§

source

type Array: Array

The array structure

source

type Object: Object

The object structure

Required Methods§

source

fn as_array(&self) -> Option<&Self::Array>

Tries to represent the value as an array and returns a reference to it

source

fn as_object(&self) -> Option<&Self::Object>

Tries to represent the value as an object and returns a reference to it

Implementations on Foreign Types§

source§

impl<V> ValueAsContainer for Option<V>

§

type Array = <V as ValueAsContainer>::Array

§

type Object = <V as ValueAsContainer>::Object

source§

fn as_array(&self) -> Option<&Self::Array>

source§

fn as_object(&self) -> Option<&Self::Object>

source§

impl<V> ValueAsContainer for &V

§

type Array = <V as ValueAsContainer>::Array

§

type Object = <V as ValueAsContainer>::Object

source§

fn as_array(&self) -> Option<&Self::Array>

source§

fn as_object(&self) -> Option<&Self::Object>

source§

impl<V, E> ValueAsContainer for Result<V, E>

§

type Array = <V as ValueAsContainer>::Array

§

type Object = <V as ValueAsContainer>::Object

source§

fn as_array(&self) -> Option<&Self::Array>

source§

fn as_object(&self) -> Option<&Self::Object>

Implementors§