Skip to main content

frame_query

Function frame_query 

Source
pub fn frame_query<V>(
    include: Rc<dyn Fn(&Pattern<V>) -> bool>,
    base: GraphQuery<V>,
) -> GraphQuery<V>
where V: GraphValue + Clone + 'static,
Expand description

Restrict a GraphQuery<V> to elements satisfying include.

The returned GraphQuery<V> is itself a full query interface. All seven structural invariants are preserved if they hold for base.

  • query_nodes / query_relationships — filtered by predicate
  • query_incident_rels(n) — base incident rels where both source AND target satisfy predicate
  • query_source / query_target — delegated unchanged to base
  • query_degree(n) — count of filtered incident rels
  • query_node_by_id(i) — base lookup; returns None if result doesn’t satisfy predicate
  • query_relationship_by_id(i) — base lookup; returns None if result doesn’t satisfy predicate
  • query_containers(p) — base containers filtered by predicate

Rc and Arc variants are intentionally separate (no macro): only one is compiled per build, and Rust does not abstract over Rc/Arc here without macros or runtime indirection.