pub struct Pattern<'a, V> {
pub entity: Either<Variable<'a>, V>,
pub attribute: Either<Variable<'a>, V>,
pub value: Either<Variable<'a>, V>,
}
Expand description
A data structure for specifying high-level constraints with NamedNetwork::add_pattern
.
Variable::Any
adds no constraint.Variable::Unify
constrains the field to the first occurrence of the variable.Either::Right
holds acrate::Value
orcrate::ValueRef
or something and will match that field to that value using equality.
FYI: entity
and attribute
should use crate::Entity
and crate::Attribute
respectively instead, but it’s a bit convenient for all the fields to be homogeneous or
whatever so you can add them to a Vec
or iterate over them or otherwise interact with them
all the same.
Can be parsed but must borrow the input string because Variable
s always borrow. See
crate::BorrowedParse
about that. Also requires the serde_json
feature to parse a Value
.
Fields
entity: Either<Variable<'a>, V>
attribute: Either<Variable<'a>, V>
value: Either<Variable<'a>, V>
Trait Implementations
sourceimpl<'a> FromBorrowedStr<'a> for Pattern<'a, Value>
impl<'a> FromBorrowedStr<'a> for Pattern<'a, Value>
Requires the serde_json
feature.
type Err = PatternParseError
fn from_borrowed_str(s: &'a str) -> Result<Self, Self::Err>
impl<'a, V> StructuralPartialEq for Pattern<'a, V>
Auto Trait Implementations
impl<'a, V> RefUnwindSafe for Pattern<'a, V> where
V: RefUnwindSafe,
impl<'a, V> Send for Pattern<'a, V> where
V: Send,
impl<'a, V> Sync for Pattern<'a, V> where
V: Sync,
impl<'a, V> Unpin for Pattern<'a, V> where
V: Unpin,
impl<'a, V> UnwindSafe for Pattern<'a, V> where
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more