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::Anyadds no constraint.Variable::Unifyconstrains the field to the first occurrence of the variable.Either::Rightholds acrate::Valueorcrate::ValueRefor 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 Variables 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§
Source§impl<'a> FromBorrowedStr<'a> for Pattern<'a, Value>
Requires the serde_json feature.
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> Freeze for Pattern<'a, V>where
V: Freeze,
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more