Trait rsonpath_lib::query::JsonPathQueryNodeType
source · pub trait JsonPathQueryNodeType {
fn is_root(&self) -> bool;
fn is_descendant(&self) -> bool;
fn is_child(&self) -> bool;
fn label(&self) -> Option<&Label>;
}
Expand description
Equips a struct with information on the type of JsonPathQueryNode
it represents
and methods to extract query elements from it.
Required Methods§
sourcefn is_root(&self) -> bool
fn is_root(&self) -> bool
Returns true
iff the type is JsonPathQueryNode::Root
.
sourcefn is_descendant(&self) -> bool
fn is_descendant(&self) -> bool
Returns true
iff the type is JsonPathQueryNode::Descendant
.
sourcefn is_child(&self) -> bool
fn is_child(&self) -> bool
Returns true
iff the type is JsonPathQueryNode::Child
.
sourcefn label(&self) -> Option<&Label>
fn label(&self) -> Option<&Label>
If the type is JsonPathQueryNode::Descendant
or JsonPathQueryNode::Child
returns the label it represents; otherwise, None
.
Implementations on Foreign Types§
source§impl<T: Deref<Target = JsonPathQueryNode>> JsonPathQueryNodeType for Option<T>
impl<T: Deref<Target = JsonPathQueryNode>> JsonPathQueryNodeType for Option<T>
Utility blanket implementation for a JsonPathQueryNode
wrapped in an Option
.
If the value is None
automatically returns false
or None
on all calls in
the natural manner.