pub trait TermMatcher {
type Term: Term + ?Sized;
// Required method
fn matches<T2: Term + ?Sized>(&self, term: &T2) -> bool;
// Provided methods
fn constant(&self) -> Option<&Self::Term> { ... }
fn gn(self) -> TermMatcherGn<Self>
where Self: Sized { ... }
fn matcher_ref(&self) -> MatcherRef<'_, Self> { ... }
}
Expand description
Generic trait for matching Term
s.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn constant(&self) -> Option<&Self::Term>
fn constant(&self) -> Option<&Self::Term>
Return None
, unless this matcher can only match a single term,
in which case this method may return that term.
This method is provided for optimization purposes, so implementing it is optional.
Sourcefn gn(self) -> TermMatcherGn<Self>where
Self: Sized,
fn gn(self) -> TermMatcherGn<Self>where
Self: Sized,
Converts this TermMatcher
into a GraphNameMatcher
If you only want to borrow this matcher as a GraphNameMatcher
,
call gn
on the result of matcher_ref
.
Sourcefn matcher_ref(&self) -> MatcherRef<'_, Self>
fn matcher_ref(&self) -> MatcherRef<'_, Self>
Return a TermMatcher
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<S, P, O> TermMatcher for (S, P, O)
impl<S, P, O> TermMatcher for (S, P, O)
Matches only embedded triple whose components match the corresponding matchers.
Source§impl<T> TermMatcher for &[T]where
T: Term,
impl<T> TermMatcher for &[T]where
T: Term,
Matches any of the terms in the slice.
Source§impl<T> TermMatcher for Option<T>where
T: Term,
impl<T> TermMatcher for Option<T>where
T: Term,
Matches the wrapped term if any, otherwise matches nothing.
Source§impl<T, const N: usize> TermMatcher for [T; N]where
T: Term,
impl<T, const N: usize> TermMatcher for [T; N]where
T: Term,
Matches any of the terms in the array.
Implementors§
Source§impl TermMatcher for TermKind
impl TermMatcher for TermKind
Matches any term if the given kind
type Term = SimpleTerm<'static>
Source§impl TermMatcher for Any
impl TermMatcher for Any
type Term = SimpleTerm<'static>
Source§impl<'a, T: TermMatcher + ?Sized> TermMatcher for MatcherRef<'a, T>
impl<'a, T: TermMatcher + ?Sized> TermMatcher for MatcherRef<'a, T>
type Term = <T as TermMatcher>::Term
Source§impl<F> TermMatcher for F
impl<F> TermMatcher for F
Matches any term satisfying the function.