Trait liquid::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<'_, Box<str, Global>>; 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<'_, Box<str, Global>>

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<'v, V> ValueView for &'v Vwhere 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<'_, Box<str, Global>>

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 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<'_, Box<str, Global>>

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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

source§

impl<K, V> ValueView for BTreeMap<K, V, Global>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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

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<'_, Box<str, Global>>

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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

source§

impl ValueView for KStringBase<Box<str, Global>>

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<'_, Box<str, Global>>

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<'_, Box<str, Global>>

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<'_, Box<str, Global>>

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<'_, Box<str, Global>>

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<'_, Box<str, Global>>

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<'_, Box<str, Global>>

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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

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<'_, Box<str, Global>>

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<'s> ValueView for KStringCowBase<'s, Box<str, Global>>

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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

source§

impl<T> ValueView for Vec<T, Global>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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

source§

impl<'s> ValueView for &'s 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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

source§

impl<K, V, S> ValueView for HashMap<K, V, S>where K: ObjectIndex, V: ValueView, S: BuildHasher,

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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

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<'_, Box<str, Global>>

source§

fn to_value(&self) -> Value

source§

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

Implementors§