sophia_api::term::matcher

Trait GraphNameMatcher

Source
pub trait GraphNameMatcher {
    type Term: Term + ?Sized;

    // Required method
    fn matches<T2: Term + ?Sized>(&self, graph_name: GraphName<&T2>) -> bool;

    // Provided methods
    fn constant(&self) -> Option<GraphName<&Self::Term>> { ... }
    fn matcher_ref(&self) -> MatcherRef<'_, Self> { ... }
}
Expand description

Generic trait for matching GraphNames.

Required Associated Types§

Source

type Term: Term + ?Sized

The type of term that this GraphNameMatcher contains

Required Methods§

Source

fn matches<T2: Term + ?Sized>(&self, graph_name: GraphName<&T2>) -> bool

Check whether this matcher matches t.

Provided Methods§

Source

fn constant(&self) -> Option<GraphName<&Self::Term>>

Return None, unless this matcher can only match a single graph name, in which case this method may return that graph name.

This method is provided for optimization purposes, so implementing it is optional.

Source

fn matcher_ref(&self) -> MatcherRef<'_, Self>

Return a GraphNameMatcher that is actually just a reference to this one.

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.

Implementations on Foreign Types§

Source§

impl GraphNameMatcher for Option<TermKind>

Source§

type Term = SimpleTerm<'static>

Source§

fn matches<T2: Term + ?Sized>(&self, graph_name: GraphName<&T2>) -> bool

Source§

impl<S, P, O> GraphNameMatcher for Option<(S, P, O)>

Matches only embedded triple whose components match the corresponding matchers.

Source§

type Term = <S as TermMatcher>::Term

Source§

fn matches<T2: Term + ?Sized>(&self, graph_name: Option<&T2>) -> bool

Source§

impl<T> GraphNameMatcher for &[GraphName<T>]
where T: Term,

Source§

type Term = T

Source§

fn matches<T2: Term + ?Sized>(&self, graph_name: GraphName<&T2>) -> bool

Source§

fn constant(&self) -> Option<GraphName<&Self::Term>>

Source§

impl<T> GraphNameMatcher for Option<Option<T>>
where T: Term,

Source§

type Term = T

Source§

fn matches<T2: Term + ?Sized>(&self, graph_name: GraphName<&T2>) -> bool

Source§

fn constant(&self) -> Option<GraphName<&Self::Term>>

Source§

impl<T, const N: usize> GraphNameMatcher for [GraphName<T>; N]
where T: Term,

Source§

type Term = T

Source§

fn matches<T2: Term + ?Sized>(&self, graph_name: GraphName<&T2>) -> bool

Source§

fn constant(&self) -> Option<GraphName<&Self::Term>>

Implementors§