#[non_exhaustive]pub struct QueryHit {
pub node: Node,
pub edges: Vec<Edge>,
pub incoming_edges: Vec<Edge>,
pub edges_truncated: bool,
}Expand description
A single query result: the matched node plus any edges requested
via Query::with_outgoing and/or Query::with_incoming.
The edges and incoming_edges fields are kept separate rather
than folded into one Vec<(Direction, Edge)> because 99% of
existing callers only care about outgoing and already destructure
.edges. The self-loop case (Query::with_any_direction on A→A)
returns ONE Edge in edges (not one in each direction) to avoid
spurious double-counting - a self-loop is structurally one edge,
not two.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.node: NodeThe matched node.
edges: Vec<Edge>Outgoing edges whose label is in the requested set. Ordered by label then edge CID for deterministic consumption.
incoming_edges: Vec<Edge>Incoming edges whose label is in the requested set. Ordered by label, then src, then edge CID for deterministic consumption.
Populated only when the query calls Query::with_incoming or
Query::with_any_direction. For pure Query::with_outgoing
queries this is always empty.
edges_truncated: booltrue if at least one of edges / incoming_edges was
truncated by the per-hit adjacency cap. Callers who need the
full fan-in/out should widen Query::adjacency_cap.
Implementations§
Source§impl QueryHit
impl QueryHit
Sourcepub fn edges_by_label(&self, label: &str) -> Vec<&Edge>
pub fn edges_by_label(&self, label: &str) -> Vec<&Edge>
All outgoing edges in this hit whose etype equals label.
Collects into a Vec<&Edge> for ergonomic iteration.
Sourcepub fn edges_by_label_iter<'a>(
&'a self,
label: &'a str,
) -> impl Iterator<Item = &'a Edge> + 'a
pub fn edges_by_label_iter<'a>( &'a self, label: &'a str, ) -> impl Iterator<Item = &'a Edge> + 'a
Streaming version of Self::edges_by_label: no intermediate
allocation. Useful in hot loops when a node has many outgoing
edges and only a fraction match the label.
Sourcepub fn incoming_by_label(&self, label: &str) -> Vec<&Edge>
pub fn incoming_by_label(&self, label: &str) -> Vec<&Edge>
All incoming edges in this hit whose etype equals label.