tremor_value::prelude

Trait ValueAsContainer

source
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 ValueAsContainer for Value

source§

type Array = Vec<Value>

source§

type Object = SizedHashMap<String, Value, NotSoRandomState>

source§

fn as_array(&self) -> Option<&Vec<Value>>

source§

fn as_object(&self) -> Option<&SizedHashMap<String, Value, NotSoRandomState>>

source§

impl<'value> ValueAsContainer for Value<'value>

source§

type Array = Vec<Value<'value>>

source§

type Object = SizedHashMap<Cow<'value, str>, Value<'value>, NotSoRandomState>

source§

fn as_array(&self) -> Option<&Vec<Value<'value>>>

source§

fn as_object( &self, ) -> Option<&SizedHashMap<Cow<'value, str>, Value<'value>, NotSoRandomState>>

source§

impl<V> ValueAsContainer for Option<V>

source§

impl<V> ValueAsContainer for &V

source§

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

Implementors§

source§

impl<'value> ValueAsContainer for tremor_value::value::Value<'value>

source§

type Array = Vec<Value<'value>>

source§

type Object = SizedHashMap<Cow<'value, str, Wide>, Value<'value>, NotSoRandomState>