Enum valkyrie_ast::PatternCondition
source · pub enum PatternCondition {
Case(PatternCaseNode),
When(PatternWhenNode),
Type(PatternTypeNode),
Else,
}Expand description
All valid branches of a pattern match statement
expr
.match {
case Some(a) | Success { value: a }
when a > 0:
print("a is positive")
when a < 0:
print("a is negative")
type Integer | Decimal:
print("a is a number")
else:
print("a is not a number")
}
.catch {
case IoError(e):
print("IO Error: " + e.message)
else:
print("Unknown error")
}
Variants§
Case(PatternCaseNode)
case Some(a) | Success { value :a }:
When(PatternWhenNode)
when a > 0:
Type(PatternTypeNode)
type Integer | Decimal:
Else
else:
Trait Implementations§
source§impl Clone for PatternCondition
impl Clone for PatternCondition
source§fn clone(&self) -> PatternCondition
fn clone(&self) -> PatternCondition
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for PatternCondition
impl Debug for PatternCondition
source§impl From<PatternCaseNode> for PatternCondition
impl From<PatternCaseNode> for PatternCondition
source§fn from(o: PatternCaseNode) -> Self
fn from(o: PatternCaseNode) -> Self
Converts to this type from the input type.
source§impl From<PatternTypeNode> for PatternCondition
impl From<PatternTypeNode> for PatternCondition
source§fn from(o: PatternTypeNode) -> Self
fn from(o: PatternTypeNode) -> Self
Converts to this type from the input type.
source§impl From<PatternWhenNode> for PatternCondition
impl From<PatternWhenNode> for PatternCondition
source§fn from(o: PatternWhenNode) -> Self
fn from(o: PatternWhenNode) -> Self
Converts to this type from the input type.
source§impl Hash for PatternCondition
impl Hash for PatternCondition
source§impl PartialEq for PatternCondition
impl PartialEq for PatternCondition
source§fn eq(&self, other: &PatternCondition) -> bool
fn eq(&self, other: &PatternCondition) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl Eq for PatternCondition
impl StructuralPartialEq for PatternCondition
Auto Trait Implementations§
impl RefUnwindSafe for PatternCondition
impl Send for PatternCondition
impl Sync for PatternCondition
impl Unpin for PatternCondition
impl UnwindSafe for PatternCondition
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