[][src]Struct json_position_parser::tree::Tree

pub struct Tree {
    pub entries: Vec<Entry>,
    pub keys: Vec<Key>,
}

Fields

entries: Vec<Entry>keys: Vec<Key>

Methods

impl Tree[src]

pub fn value_at(&self, path: &[PathType]) -> Vec<&Entry>[src]

Get values at a path. Wildcard and recursive wildcard available.

Example

let text = "{ \"a\": { \"b\": ["c"] } }";
match parse_json(&text) {
    Ok(tree) => {
        let keys = tree.values_at(&[
           PathType::Object("a"),
           PathType::Object("b"),
           PathType::Array(0),
        ]);
    },
    Err(e) => println!("{:?}", e),
};

pub fn keys_at(&self, path: &[PathType]) -> Vec<&Key>[src]

Get keys at a path. Wildcard and recursive wildcard available.

Example

let text = "{ \"a\": { \"b\": ["c"] } }";
match parse_json(&text) {
    Ok(tree) => {
        let keys = tree.keys_at(&[
           PathType::Object("a"),
           PathType::Object("b"),
           PathType::Array(0),
        ]);
    },
    Err(e) => println!("{:?}", e),
};

Trait Implementations

impl Debug for Tree[src]

Auto Trait Implementations

impl RefUnwindSafe for Tree

impl Send for Tree

impl Sync for Tree

impl Unpin for Tree

impl UnwindSafe for Tree

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.