Trait Queryable
pub trait Queryable<'tree, 'node> {
Show 29 methods
// Required method
fn node(&'node self) -> Node<'tree>;
// Provided methods
fn query_all(
&'node self,
by: By<'tree>,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn get_all(
&'node self,
by: By<'tree>,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn query(&'node self, by: By<'tree>) -> Option<Node<'tree>> { ... }
fn get(&'node self, by: By<'tree>) -> Node<'tree> { ... }
fn query_all_by_label(
&'node self,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn get_all_by_label(
&'node self,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn query_by_label(&'node self, label: &'tree str) -> Option<Node<'tree>> { ... }
fn get_by_label(&'node self, label: &'tree str) -> Node<'tree> { ... }
fn query_all_by_label_contains(
&'node self,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn get_all_by_label_contains(
&'node self,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn query_by_label_contains(
&'node self,
label: &'tree str,
) -> Option<Node<'tree>> { ... }
fn get_by_label_contains(&'node self, label: &'tree str) -> Node<'tree> { ... }
fn query_all_by_role_and_label(
&'node self,
role: Role,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn get_all_by_role_and_label(
&'node self,
role: Role,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn query_by_role_and_label(
&'node self,
role: Role,
label: &'tree str,
) -> Option<Node<'tree>> { ... }
fn get_by_role_and_label(
&'node self,
role: Role,
label: &'tree str,
) -> Node<'tree> { ... }
fn query_all_by_role(
&'node self,
role: Role,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn get_all_by_role(
&'node self,
role: Role,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn query_by_role(&'node self, role: Role) -> Option<Node<'tree>> { ... }
fn get_by_role(&'node self, role: Role) -> Node<'tree> { ... }
fn query_all_by_value(
&'node self,
value: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn get_all_by_value(
&'node self,
value: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn query_by_value(&'node self, value: &'tree str) -> Option<Node<'tree>> { ... }
fn get_by_value(&'node self, value: &'tree str) -> Node<'tree> { ... }
fn query_all_by(
&'node self,
f: impl Fn(&Node<'_>) -> bool + 'tree,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn get_all_by(
&'node self,
f: impl Fn(&Node<'_>) -> bool + 'tree,
) -> impl DoubleEndedIterator + FusedIterator + 'tree { ... }
fn query_by(
&'node self,
f: impl Fn(&Node<'_>) -> bool + 'tree,
) -> Option<Node<'tree>> { ... }
fn get_by(&'node self, f: impl Fn(&Node<'_>) -> bool + 'tree) -> Node<'tree> { ... }
}
Expand description
Provides convenience methods for querying nodes in the tree, inspired by https://testing-library.com/.
Required Methods§
Provided Methods§
fn query_all(
&'node self,
by: By<'tree>,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn query_all( &'node self, by: By<'tree>, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Query all nodes in the tree where
the node matches the given By
filter.
fn get_all(
&'node self,
by: By<'tree>,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn get_all( &'node self, by: By<'tree>, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn query(&'node self, by: By<'tree>) -> Option<Node<'tree>>
fn query(&'node self, by: By<'tree>) -> Option<Node<'tree>>
Query a single node in the tree where
the node matches the given By
filter.
Returns None
if no nodes are found.
fn query_all_by_label(
&'node self,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn query_all_by_label( &'node self, label: &'tree str, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Query all nodes in the tree where the node label exactly matches given label.
If a node is labelled by another node, the label node will not be included in the results.
fn get_all_by_label(
&'node self,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn get_all_by_label( &'node self, label: &'tree str, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Get all nodes in the tree where the node label exactly matches given label. Returns at least one node.
If a node is labelled by another node, the label node will not be included in the results.
§Panics
- if no nodes are found matching the query.
fn query_by_label(&'node self, label: &'tree str) -> Option<Node<'tree>>
fn query_by_label(&'node self, label: &'tree str) -> Option<Node<'tree>>
Query a single node in the tree where
the node label exactly matches given label.
Returns None
if no nodes are found.
If a node is labelled by another node, the label node will not be included in the results.
fn get_by_label(&'node self, label: &'tree str) -> Node<'tree>
fn get_by_label(&'node self, label: &'tree str) -> Node<'tree>
Get a single node in the tree where the node label exactly matches given label.
If a node is labelled by another node, the label node will not be included in the results.
§Panics
- if no nodes are found matching the query.
- if more than one node is found matching the query.
fn query_all_by_label_contains(
&'node self,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn query_all_by_label_contains( &'node self, label: &'tree str, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Query all nodes in the tree where the node label contains the given substring.
If a node is labelled by another node, the label node will not be included in the results.
fn get_all_by_label_contains(
&'node self,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn get_all_by_label_contains( &'node self, label: &'tree str, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Get all nodes in the tree where the node label contains the given substring. Returns at least one node.
If a node is labelled by another node, the label node will not be included in the results.
§Panics
- if no nodes are found matching the query.
fn query_by_label_contains(
&'node self,
label: &'tree str,
) -> Option<Node<'tree>>
fn query_by_label_contains( &'node self, label: &'tree str, ) -> Option<Node<'tree>>
Query a single node in the tree where
the node label contains the given substring.
Returns None
if no nodes are found.
If a node is labelled by another node, the label node will not be included in the results.
fn get_by_label_contains(&'node self, label: &'tree str) -> Node<'tree>
fn get_by_label_contains(&'node self, label: &'tree str) -> Node<'tree>
Get a single node in the tree where the node label contains the given substring.
If a node is labelled by another node, the label node will not be included in the results.
§Panics
- if no nodes are found matching the query.
- if more than one node is found matching the query.
fn query_all_by_role_and_label(
&'node self,
role: Role,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn query_all_by_role_and_label( &'node self, role: Role, label: &'tree str, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Query all nodes in the tree where the node role and label exactly match the given role and label.
If a node is labelled by another node, the label node will not be included in the results.
fn get_all_by_role_and_label(
&'node self,
role: Role,
label: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn get_all_by_role_and_label( &'node self, role: Role, label: &'tree str, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Get all nodes in the tree where the node role and label exactly match the given role and label. Returns at least one node.
If a node is labelled by another node, the label node will not be included in the results.
§Panics
- if no nodes are found matching the query.
fn query_by_role_and_label(
&'node self,
role: Role,
label: &'tree str,
) -> Option<Node<'tree>>
fn query_by_role_and_label( &'node self, role: Role, label: &'tree str, ) -> Option<Node<'tree>>
Query a single node in the tree where
the node role and label exactly match the given role and label.
Returns None
if no nodes are found.
If a node is labelled by another node, the label node will not be included in the results.
fn get_by_role_and_label(
&'node self,
role: Role,
label: &'tree str,
) -> Node<'tree>
fn get_by_role_and_label( &'node self, role: Role, label: &'tree str, ) -> Node<'tree>
Get a single node in the tree where the node role and label exactly match the given role and label.
If a node is labelled by another node, the label node will not be included in the results.
§Panics
- if no nodes are found matching the query.
- if more than one node is found matching the query.
fn query_all_by_role(
&'node self,
role: Role,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn query_all_by_role( &'node self, role: Role, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Query all nodes in the tree where the node role matches the given role.
fn get_all_by_role(
&'node self,
role: Role,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn get_all_by_role( &'node self, role: Role, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Get all nodes in the tree where the node role matches the given role. Returns at least one node.
§Panics
- if no nodes are found matching the query.
fn query_by_role(&'node self, role: Role) -> Option<Node<'tree>>
fn query_by_role(&'node self, role: Role) -> Option<Node<'tree>>
Query a single node in the tree where
the node role matches the given role.
Returns None
if no nodes are found.
fn get_by_role(&'node self, role: Role) -> Node<'tree>
fn get_by_role(&'node self, role: Role) -> Node<'tree>
Get a single node in the tree where the node role matches the given role.
§Panics
- if no nodes are found matching the query.
- if more than one node is found matching the query.
fn query_all_by_value(
&'node self,
value: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn query_all_by_value( &'node self, value: &'tree str, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Query all nodes in the tree where the node value exactly matches the given value.
fn get_all_by_value(
&'node self,
value: &'tree str,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn get_all_by_value( &'node self, value: &'tree str, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Get all nodes in the tree where the node value exactly matches the given value. Returns at least one node.
§Panics
- if no nodes are found matching the query.
fn query_by_value(&'node self, value: &'tree str) -> Option<Node<'tree>>
fn query_by_value(&'node self, value: &'tree str) -> Option<Node<'tree>>
Query a single node in the tree where
the node value exactly matches the given value.
Returns None
if no nodes are found.
fn get_by_value(&'node self, value: &'tree str) -> Node<'tree>
fn get_by_value(&'node self, value: &'tree str) -> Node<'tree>
Get a single node in the tree where the node value exactly matches the given value.
§Panics
- if no nodes are found matching the query.
- if more than one node is found matching the query.
fn query_all_by(
&'node self,
f: impl Fn(&Node<'_>) -> bool + 'tree,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn query_all_by( &'node self, f: impl Fn(&Node<'_>) -> bool + 'tree, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Query all nodes in the tree where the node matches the given predicate.
fn get_all_by(
&'node self,
f: impl Fn(&Node<'_>) -> bool + 'tree,
) -> impl DoubleEndedIterator + FusedIterator + 'tree
fn get_all_by( &'node self, f: impl Fn(&Node<'_>) -> bool + 'tree, ) -> impl DoubleEndedIterator + FusedIterator + 'tree
Get all nodes in the tree where the node matches the given predicate. Returns at least one node.
§Panics
- if no nodes are found matching the query.
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.