Trait liquid_core::ValueView[][src]

pub trait ValueView: Debug {
    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) -> KStringCow<'_>;
fn to_value(&self) -> Value; 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 { ... } }

Accessor for Values.

Required methods

fn as_debug(&self) -> &dyn Debug[src]

Get a Debug representation

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

A Display for a BoxedValue rendered for the user.

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

A Display for a Value as source code.

fn type_name(&self) -> &'static str[src]

Report the data type (generally for error reporting).

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

Query the value's state

fn to_kstr(&self) -> KStringCow<'_>[src]

Interpret as a string.

fn to_value(&self) -> Value[src]

Convert to an owned type.

Loading content...

Provided methods

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

Extracts the scalar value if it is a scalar.

fn is_scalar(&self) -> bool[src]

Tests whether this value is a scalar

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

Extracts the array value if it is an array.

fn is_array(&self) -> bool[src]

Tests whether this value is an array

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

Extracts the object value if it is a object.

fn is_object(&self) -> bool[src]

Tests whether this value is an object

fn as_state(&self) -> Option<State>[src]

Extracts the state if it is one

fn is_state(&self) -> bool[src]

Tests whether this value is state

fn is_nil(&self) -> bool[src]

Tests whether this value is nil

See https://stackoverflow.com/questions/885414/a-concise-explanation-of-nil-v-empty-v-blank-in-ruby-on-rails

Loading content...

Implementations on Foreign Types

impl<T: ValueView> ValueView for Vec<T>[src]

impl<K: ObjectIndex, V: ValueView, S: BuildHasher> ValueView for HashMap<K, V, S>[src]

impl<K: ObjectIndex, V: ValueView> ValueView for BTreeMap<K, V>[src]

impl ValueView for i64[src]

impl ValueView for u8[src]

impl ValueView for i8[src]

impl ValueView for u16[src]

impl ValueView for i16[src]

impl ValueView for u32[src]

impl ValueView for i32[src]

impl ValueView for f64[src]

impl ValueView for f32[src]

impl ValueView for bool[src]

impl<'s> ValueView for &'s str[src]

impl ValueView for String[src]

impl ValueView for KString[src]

impl<'s> ValueView for KStringCow<'s>[src]

impl<'s> ValueView for KStringRef<'s>[src]

impl<T: ValueView> ValueView for Option<T>[src]

Loading content...

Implementors

impl ValueView for State[src]

impl ValueView for Value[src]

impl ValueView for Object[src]

impl ValueView for Date[src]

impl ValueView for DateTime[src]

impl<'s> ValueView for ValueCow<'s>[src]

impl<'s> ValueView for ScalarCow<'s>[src]

Loading content...