Trait ValueView

Source
pub trait ValueView: Debug {
Show 16 methods // Required methods fn as_debug(&self) -> &dyn Debug; fn render(&self) -> DisplayCow<'_>; fn source(&self) -> DisplayCow<'_>; fn type_name(&self) -> &'static str; fn query_state(&self, state: State) -> bool; fn to_kstr(&self) -> KStringCowBase<'_>; fn to_value(&self) -> Value; // Provided methods fn as_scalar(&self) -> Option<ScalarCow<'_>> { ... } fn is_scalar(&self) -> bool { ... } fn as_array(&self) -> Option<&dyn ArrayView> { ... } fn is_array(&self) -> bool { ... } fn as_object(&self) -> Option<&dyn ObjectView> { ... } fn is_object(&self) -> bool { ... } fn as_state(&self) -> Option<State> { ... } fn is_state(&self) -> bool { ... } fn is_nil(&self) -> bool { ... }
}
Expand description

Accessor for Values.

Required Methods§

Source

fn as_debug(&self) -> &dyn Debug

Get a Debug representation

Source

fn render(&self) -> DisplayCow<'_>

A Display for a BoxedValue rendered for the user.

Source

fn source(&self) -> DisplayCow<'_>

A Display for a Value as source code.

Source

fn type_name(&self) -> &'static str

Report the data type (generally for error reporting).

Source

fn query_state(&self, state: State) -> bool

Query the value’s state

Source

fn to_kstr(&self) -> KStringCowBase<'_>

Interpret as a string.

Source

fn to_value(&self) -> Value

Convert to an owned type.

Provided Methods§

Source

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Extracts the scalar value if it is a scalar.

Source

fn is_scalar(&self) -> bool

Tests whether this value is a scalar

Source

fn as_array(&self) -> Option<&dyn ArrayView>

Extracts the array value if it is an array.

Source

fn is_array(&self) -> bool

Tests whether this value is an array

Source

fn as_object(&self) -> Option<&dyn ObjectView>

Extracts the object value if it is a object.

Source

fn is_object(&self) -> bool

Tests whether this value is an object

Source

fn as_state(&self) -> Option<State>

Extracts the state if it is one

Source

fn is_state(&self) -> bool

Tests whether this value is state

Source

fn is_nil(&self) -> bool

Tests whether this value is nil

See the Stack overflow table

Implementations on Foreign Types§

Source§

impl ValueView for &str

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for bool

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for f32

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for f64

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for i8

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for i16

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for i32

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for i64

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for u8

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for u16

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for u32

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for String

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for KStringBase<Box<str>>

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl ValueView for KStringCowBase<'_>

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

impl<'p> ValueView for ForloopObject<'p>

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_object(&self) -> Option<&dyn ObjectView>

Source§

impl<K, V> ValueView for BTreeMap<K, V>
where K: ObjectIndex, V: ValueView,

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_object(&self) -> Option<&dyn ObjectView>

Source§

impl<K, V, S> ValueView for HashMap<K, V, S>

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_object(&self) -> Option<&dyn ObjectView>

Source§

impl<T> ValueView for Option<T>
where T: ValueView,

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

fn as_array(&self) -> Option<&dyn ArrayView>

Source§

fn as_object(&self) -> Option<&dyn ObjectView>

Source§

fn as_state(&self) -> Option<State>

Source§

fn is_nil(&self) -> bool

Source§

impl<T> ValueView for Vec<T>
where T: ValueView,

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_array(&self) -> Option<&dyn ArrayView>

Source§

impl<V> ValueView for &V
where V: ValueView + ?Sized,

Source§

fn as_debug(&self) -> &dyn Debug

Source§

fn render(&self) -> DisplayCow<'_>

Source§

fn source(&self) -> DisplayCow<'_>

Source§

fn type_name(&self) -> &'static str

Source§

fn query_state(&self, state: State) -> bool

Source§

fn to_kstr(&self) -> KStringCowBase<'_>

Source§

fn to_value(&self) -> Value

Source§

fn as_scalar(&self) -> Option<ScalarCow<'_>>

Source§

fn as_array(&self) -> Option<&dyn ArrayView>

Source§

fn as_object(&self) -> Option<&dyn ObjectView>

Source§

fn as_state(&self) -> Option<State>

Source§

fn is_nil(&self) -> bool

Implementors§