Trait rsonpath::query::JsonPathQueryNodeType
source · pub trait JsonPathQueryNodeType {
// Required methods
fn is_root(&self) -> bool;
fn is_descendant(&self) -> bool;
fn is_any_descendant(&self) -> bool;
fn is_child(&self) -> bool;
fn is_any_child(&self) -> bool;
fn member_name(&self) -> Option<&JsonString>;
fn array_index(&self) -> Option<&NonNegativeArrayIndex>;
}
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_any_descendant(&self) -> bool
fn is_any_descendant(&self) -> bool
Returns true
iff the type is JsonPathQueryNode::AnyDescendant
.
sourcefn is_child(&self) -> bool
fn is_child(&self) -> bool
Returns true
iff the type is JsonPathQueryNode::Child
.
sourcefn is_any_child(&self) -> bool
fn is_any_child(&self) -> bool
Returns true
iff the type is JsonPathQueryNode::AnyChild
.
sourcefn member_name(&self) -> Option<&JsonString>
fn member_name(&self) -> Option<&JsonString>
If the type is JsonPathQueryNode::Descendant
or JsonPathQueryNode::Child
returns the member name it represents; otherwise, None
.
sourcefn array_index(&self) -> Option<&NonNegativeArrayIndex>
fn array_index(&self) -> Option<&NonNegativeArrayIndex>
If the type is JsonPathQueryNode::ArrayIndexDescendant
or JsonPathQueryNode::ArrayIndexChild
returns the index 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.