Trait Queryable

Source
pub trait Queryable
where Self: Sized,
{ // Required methods fn query_kind(&self) -> Option<QueryKind>; fn query_dict(&self, path: &str) -> Result<Self, Error>; fn query_array(&self, idx: usize) -> Result<Self, Error>; // Provided method fn query<T>(&self, path: &str) -> Result<Self, Error> where T: Tokenizer { ... } }
Expand description

Queryable trait.

The main trait that need to be implemented by data structure. This trait assume that Self are sum types or linear? type.

Required Methods§

Source

fn query_kind(&self) -> Option<QueryKind>

Identify Self as either one of QueryKind value.

Since traversal only happens in data structure like dictionary type and array type, other that mostly are literal (leaf).

Source

fn query_dict(&self, path: &str) -> Result<Self, Error>

Querying based on key str on Self.

This method need to be implemented in case Self supports querying by path/key &str.

Source

fn query_array(&self, idx: usize) -> Result<Self, Error>

Querying based on index on Self.

This method need to be implemented in case of Self supports querying by index usize.

Provided Methods§

Source

fn query<T>(&self, path: &str) -> Result<Self, Error>
where T: Tokenizer,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§