pub trait ValueInto: Sized + ValueAccess {
    type String;

    // Required methods
    fn into_string(self) -> Option<Self::String>;
    fn into_array(self) -> Option<Self::Array>;
    fn into_object(self) -> Option<Self::Object>;

    // Provided methods
    fn try_into_string(self) -> Result<Self::String, TryTypeError> { ... }
    fn try_into_array(self) -> Result<Self::Array, TryTypeError> { ... }
    fn try_into_object(self) -> Result<Self::Object, TryTypeError> { ... }
}
Expand description

A trait that specifies how to turn the Value into it’s sub types

Required Associated Types§

source

type String

The type for Strings

Required Methods§

source

fn into_string(self) -> Option<Self::String>

Tries to turn the value into it’s string representation

source

fn into_array(self) -> Option<Self::Array>

Tries to turn the value into it’s array representation

source

fn into_object(self) -> Option<Self::Object>

Tries to turn the value into it’s object representation

Provided Methods§

source

fn try_into_string(self) -> Result<Self::String, TryTypeError>

Tries to turn the value into it’s string representation

Errors

if the requested type doesn’t match the actual type

source

fn try_into_array(self) -> Result<Self::Array, TryTypeError>

Tries to turn the value into it’s array representation

Errors

if the requested type doesn’t match the actual type

source

fn try_into_object(self) -> Result<Self::Object, TryTypeError>

Tries to turn the value into it’s object representation

Errors

if the requested type doesn’t match the actual type

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<V> ValueInto for Option<V>where V: ValueInto,

source§

impl<V, E> ValueInto for Result<V, E>where V: ValueInto,

Implementors§

source§

impl ValueInto for simd_json::value::owned::Value

source§

impl<'value> ValueInto for simd_json::value::borrowed::Value<'value>

§

type String = Cow<'value, str>