jsonpath_rust::path

Trait Path

Source
pub trait Path<'a> {
    type Data;

    // Provided methods
    fn find(
        &self,
        input: JsonPathValue<'a, Self::Data>,
    ) -> Vec<JsonPathValue<'a, Self::Data>> { ... }
    fn flat_find(
        &self,
        input: Vec<JsonPathValue<'a, Self::Data>>,
        _is_search_length: bool,
    ) -> Vec<JsonPathValue<'a, Self::Data>> { ... }
    fn needs_all(&self) -> bool { ... }
}
Expand description

The trait defining the behaviour of processing every separated element. type Data usually stands for json [Value] The trait also requires to have a root json to process. It needs in case if in the filter there will be a pointer to the absolute path

Required Associated Types§

Provided Methods§

Source

fn find( &self, input: JsonPathValue<'a, Self::Data>, ) -> Vec<JsonPathValue<'a, Self::Data>>

when every element needs to handle independently

Source

fn flat_find( &self, input: Vec<JsonPathValue<'a, Self::Data>>, _is_search_length: bool, ) -> Vec<JsonPathValue<'a, Self::Data>>

when the whole output needs to handle

Source

fn needs_all(&self) -> bool

defines when we need to invoke find or flat_find

Implementors§

Source§

impl<'a, T> Path<'a> for FilterPath<'a, T>
where T: JsonLike,

Source§

type Data = T

Source§

impl<'a, T> Path<'a> for TopPaths<'a, T>
where T: JsonLike,

Source§

type Data = T

Source§

impl<'a, T> Path<'a> for ArrayIndex<T>
where T: JsonLike,

Source§

type Data = T

Source§

impl<'a, T> Path<'a> for ArraySlice<T>
where T: JsonLike,

Source§

type Data = T

Source§

impl<'a, T> Path<'a> for Current<'a, T>
where T: JsonLike,

Source§

type Data = T

Source§

impl<'a, T> Path<'a> for ObjectField<'a, T>
where T: JsonLike,

Source§

type Data = T

Source§

impl<'a, T> Path<'a> for UnionIndex<'a, T>
where T: JsonLike,

Source§

type Data = T