pub enum Pattern {
MatchValue(PatternMatchValue),
MatchSingleton(PatternMatchSingleton),
MatchSequence(PatternMatchSequence),
MatchMapping(PatternMatchMapping),
MatchClass(PatternMatchClass),
MatchStar(PatternMatchStar),
MatchAs(PatternMatchAs),
MatchOr(PatternMatchOr),
}Expand description
See also pattern
Variants§
MatchValue(PatternMatchValue)
MatchSingleton(PatternMatchSingleton)
MatchSequence(PatternMatchSequence)
MatchMapping(PatternMatchMapping)
MatchClass(PatternMatchClass)
MatchStar(PatternMatchStar)
MatchAs(PatternMatchAs)
MatchOr(PatternMatchOr)
Implementations§
Source§impl Pattern
impl Pattern
pub const fn is_match_value(&self) -> bool
pub fn match_value(self) -> Option<PatternMatchValue>
pub fn expect_match_value(self) -> PatternMatchValue
pub fn as_match_value_mut(&mut self) -> Option<&mut PatternMatchValue>
pub fn as_match_value(&self) -> Option<&PatternMatchValue>
pub const fn is_match_singleton(&self) -> bool
pub fn match_singleton(self) -> Option<PatternMatchSingleton>
pub fn expect_match_singleton(self) -> PatternMatchSingleton
pub fn as_match_singleton_mut(&mut self) -> Option<&mut PatternMatchSingleton>
pub fn as_match_singleton(&self) -> Option<&PatternMatchSingleton>
pub const fn is_match_sequence(&self) -> bool
pub fn match_sequence(self) -> Option<PatternMatchSequence>
pub fn expect_match_sequence(self) -> PatternMatchSequence
pub fn as_match_sequence_mut(&mut self) -> Option<&mut PatternMatchSequence>
pub fn as_match_sequence(&self) -> Option<&PatternMatchSequence>
pub const fn is_match_mapping(&self) -> bool
pub fn match_mapping(self) -> Option<PatternMatchMapping>
pub fn expect_match_mapping(self) -> PatternMatchMapping
pub fn as_match_mapping_mut(&mut self) -> Option<&mut PatternMatchMapping>
pub fn as_match_mapping(&self) -> Option<&PatternMatchMapping>
pub const fn is_match_class(&self) -> bool
pub fn match_class(self) -> Option<PatternMatchClass>
pub fn expect_match_class(self) -> PatternMatchClass
pub fn as_match_class_mut(&mut self) -> Option<&mut PatternMatchClass>
pub fn as_match_class(&self) -> Option<&PatternMatchClass>
pub const fn is_match_star(&self) -> bool
pub fn match_star(self) -> Option<PatternMatchStar>
pub fn expect_match_star(self) -> PatternMatchStar
pub fn as_match_star_mut(&mut self) -> Option<&mut PatternMatchStar>
pub fn as_match_star(&self) -> Option<&PatternMatchStar>
pub const fn is_match_as(&self) -> bool
pub fn match_as(self) -> Option<PatternMatchAs>
pub fn expect_match_as(self) -> PatternMatchAs
pub fn as_match_as_mut(&mut self) -> Option<&mut PatternMatchAs>
pub fn as_match_as(&self) -> Option<&PatternMatchAs>
pub const fn is_match_or(&self) -> bool
pub fn match_or(self) -> Option<PatternMatchOr>
pub fn expect_match_or(self) -> PatternMatchOr
pub fn as_match_or_mut(&mut self) -> Option<&mut PatternMatchOr>
pub fn as_match_or(&self) -> Option<&PatternMatchOr>
Source§impl Pattern
impl Pattern
Sourcepub fn is_irrefutable(&self) -> bool
pub fn is_irrefutable(&self) -> bool
Checks if the Pattern is an irrefutable pattern.
Sourcepub fn irrefutable_pattern(&self) -> Option<IrrefutablePattern>
pub fn irrefutable_pattern(&self) -> Option<IrrefutablePattern>
Return Some(IrrefutablePattern) if self is irrefutable or None otherwise.
Sourcepub fn is_wildcard(&self) -> bool
pub fn is_wildcard(&self) -> bool
Checks if the Pattern is a wildcard pattern.
The following are wildcard patterns:
match subject:
case _ as x: ...
case _ | _: ...
case _: ...Trait Implementations§
Source§impl<'a> From<&'a Pattern> for AnyNodeRef<'a>
impl<'a> From<&'a Pattern> for AnyNodeRef<'a>
Source§fn from(node: &'a Pattern) -> AnyNodeRef<'a>
fn from(node: &'a Pattern) -> AnyNodeRef<'a>
Converts to this type from the input type.
Source§impl<'a> From<&'a Pattern> for AnyRootNodeRef<'a>
impl<'a> From<&'a Pattern> for AnyRootNodeRef<'a>
Source§fn from(node: &'a Pattern) -> AnyRootNodeRef<'a>
fn from(node: &'a Pattern) -> AnyRootNodeRef<'a>
Converts to this type from the input type.
Source§impl<'a> From<&'a Pattern> for ComparablePattern<'a>
impl<'a> From<&'a Pattern> for ComparablePattern<'a>
Source§impl<'a> From<&'a Pattern> for PatternRef<'a>
impl<'a> From<&'a Pattern> for PatternRef<'a>
Source§impl From<PatternMatchAs> for Pattern
impl From<PatternMatchAs> for Pattern
Source§fn from(node: PatternMatchAs) -> Self
fn from(node: PatternMatchAs) -> Self
Converts to this type from the input type.
Source§impl From<PatternMatchClass> for Pattern
impl From<PatternMatchClass> for Pattern
Source§fn from(node: PatternMatchClass) -> Self
fn from(node: PatternMatchClass) -> Self
Converts to this type from the input type.
Source§impl From<PatternMatchMapping> for Pattern
impl From<PatternMatchMapping> for Pattern
Source§fn from(node: PatternMatchMapping) -> Self
fn from(node: PatternMatchMapping) -> Self
Converts to this type from the input type.
Source§impl From<PatternMatchOr> for Pattern
impl From<PatternMatchOr> for Pattern
Source§fn from(node: PatternMatchOr) -> Self
fn from(node: PatternMatchOr) -> Self
Converts to this type from the input type.
Source§impl From<PatternMatchSequence> for Pattern
impl From<PatternMatchSequence> for Pattern
Source§fn from(node: PatternMatchSequence) -> Self
fn from(node: PatternMatchSequence) -> Self
Converts to this type from the input type.
Source§impl From<PatternMatchSingleton> for Pattern
impl From<PatternMatchSingleton> for Pattern
Source§fn from(node: PatternMatchSingleton) -> Self
fn from(node: PatternMatchSingleton) -> Self
Converts to this type from the input type.
Source§impl From<PatternMatchStar> for Pattern
impl From<PatternMatchStar> for Pattern
Source§fn from(node: PatternMatchStar) -> Self
fn from(node: PatternMatchStar) -> Self
Converts to this type from the input type.
Source§impl From<PatternMatchValue> for Pattern
impl From<PatternMatchValue> for Pattern
Source§fn from(node: PatternMatchValue) -> Self
fn from(node: PatternMatchValue) -> Self
Converts to this type from the input type.
Source§impl HasNodeIndex for Pattern
impl HasNodeIndex for Pattern
Source§fn node_index(&self) -> &AtomicNodeIndex
fn node_index(&self) -> &AtomicNodeIndex
Returns the
AtomicNodeIndex for this node.Source§impl<'a> TryFrom<AnyRootNodeRef<'a>> for &'a Pattern
impl<'a> TryFrom<AnyRootNodeRef<'a>> for &'a Pattern
impl StructuralPartialEq for Pattern
Auto Trait Implementations§
impl !Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnsafeUnpin 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