pub enum Pattern {
Show 17 variants
Wildcard(String),
Constant(f64),
Symbol(String),
Zero,
One,
Add(Box<Self>, Box<Self>),
Mul(Box<Self>, Box<Self>),
Pow(Box<Self>, Box<Self>),
Neg(Box<Self>),
Sin(Box<Self>),
Cos(Box<Self>),
Exp(Box<Self>),
Log(Box<Self>),
Commutator(Box<Self>, Box<Self>),
Anticommutator(Box<Self>, Box<Self>),
TensorProduct(Box<Self>, Box<Self>),
Dagger(Box<Self>),
}Expand description
A pattern that can match against expressions.
Variants§
Wildcard(String)
Match any expression and capture it
Constant(f64)
Match a specific constant
Symbol(String)
Match a specific symbol
Zero
Match zero
One
Match one
Add(Box<Self>, Box<Self>)
Match an addition pattern
Mul(Box<Self>, Box<Self>)
Match a multiplication pattern
Pow(Box<Self>, Box<Self>)
Match a power pattern
Neg(Box<Self>)
Match a negation pattern
Sin(Box<Self>)
Match a sine pattern
Cos(Box<Self>)
Match a cosine pattern
Exp(Box<Self>)
Match an exponential pattern
Log(Box<Self>)
Match a logarithm pattern
Commutator(Box<Self>, Box<Self>)
Match a commutator pattern
Anticommutator(Box<Self>, Box<Self>)
Match an anticommutator pattern
TensorProduct(Box<Self>, Box<Self>)
Match a tensor product pattern
Dagger(Box<Self>)
Match a dagger pattern
Implementations§
Source§impl Pattern
impl Pattern
Sourcepub fn commutator(a: Self, b: Self) -> Self
pub fn commutator(a: Self, b: Self) -> Self
Create a commutator pattern [A, B]
Sourcepub fn anticommutator(a: Self, b: Self) -> Self
pub fn anticommutator(a: Self, b: Self) -> Self
Create an anticommutator pattern {A, B}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnwindSafe for Pattern
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more