Pattern

Struct Pattern 

Source
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.

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, V: Debug> Debug for Pattern<'a, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> FromBorrowedStr<'a> for Pattern<'a, Value>

Requires the serde_json feature.

Source§

impl<'a, V: PartialEq> PartialEq for Pattern<'a, V>

Source§

fn eq(&self, other: &Pattern<'a, V>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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> 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> 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, 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.