Skip to main content

GraphQuery

Struct GraphQuery 

Source
pub struct GraphQuery<V: GraphValue> {
    pub query_nodes: Rc<dyn Fn() -> Vec<Pattern<V>>>,
    pub query_relationships: Rc<dyn Fn() -> Vec<Pattern<V>>>,
    pub query_incident_rels: Rc<dyn Fn(&Pattern<V>) -> Vec<Pattern<V>>>,
    pub query_source: Rc<dyn Fn(&Pattern<V>) -> Option<Pattern<V>>>,
    pub query_target: Rc<dyn Fn(&Pattern<V>) -> Option<Pattern<V>>>,
    pub query_degree: Rc<dyn Fn(&Pattern<V>) -> usize>,
    pub query_node_by_id: Rc<dyn Fn(&V::Id) -> Option<Pattern<V>>>,
    pub query_relationship_by_id: Rc<dyn Fn(&V::Id) -> Option<Pattern<V>>>,
    pub query_containers: Rc<dyn Fn(&Pattern<V>) -> Vec<Pattern<V>>>,
}
Expand description

Portable graph query interface: a struct of nine closures.

All graph algorithms operate against GraphQuery<V>, not against any specific backing representation. Cloning is cheap — it increments reference counts only.

§Construction

Use crate::from_pattern_graph to wrap a crate::PatternGraph, or build manually by providing all nine closure fields.

§Thread Safety

By default uses Rc (single-threaded). Enable the thread-safe Cargo feature to use Arc with Send + Sync bounds throughout.

Fields§

§query_nodes: Rc<dyn Fn() -> Vec<Pattern<V>>>

Returns all node patterns in the graph.

§query_relationships: Rc<dyn Fn() -> Vec<Pattern<V>>>

Returns all relationship patterns in the graph.

§query_incident_rels: Rc<dyn Fn(&Pattern<V>) -> Vec<Pattern<V>>>

Returns all relationships incident to the given node (as source or target).

§query_source: Rc<dyn Fn(&Pattern<V>) -> Option<Pattern<V>>>

Returns the source node of a relationship, or None if not available.

§query_target: Rc<dyn Fn(&Pattern<V>) -> Option<Pattern<V>>>

Returns the target node of a relationship, or None if not available.

§query_degree: Rc<dyn Fn(&Pattern<V>) -> usize>

Returns the count of incident relationships for a node.

§query_node_by_id: Rc<dyn Fn(&V::Id) -> Option<Pattern<V>>>

Returns the node with the given identity, or None.

§query_relationship_by_id: Rc<dyn Fn(&V::Id) -> Option<Pattern<V>>>

Returns the relationship with the given identity, or None.

§query_containers: Rc<dyn Fn(&Pattern<V>) -> Vec<Pattern<V>>>

Returns all direct containers of the given element (relationships, walks, annotations).

Trait Implementations§

Source§

impl<V: GraphValue> Clone for GraphQuery<V>

Available on non-crate feature thread-safe only.
Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<V> Freeze for GraphQuery<V>

§

impl<V> !RefUnwindSafe for GraphQuery<V>

§

impl<V> !Send for GraphQuery<V>

§

impl<V> !Sync for GraphQuery<V>

§

impl<V> Unpin for GraphQuery<V>

§

impl<V> UnsafeUnpin for GraphQuery<V>

§

impl<V> !UnwindSafe for GraphQuery<V>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.