pub enum PatternRef<'a> {
MatchValue(&'a PatternMatchValue),
MatchSingleton(&'a PatternMatchSingleton),
MatchSequence(&'a PatternMatchSequence),
MatchMapping(&'a PatternMatchMapping),
MatchClass(&'a PatternMatchClass),
MatchStar(&'a PatternMatchStar),
MatchAs(&'a PatternMatchAs),
MatchOr(&'a PatternMatchOr),
}Expand description
See also pattern
Variants§
MatchValue(&'a PatternMatchValue)
MatchSingleton(&'a PatternMatchSingleton)
MatchSequence(&'a PatternMatchSequence)
MatchMapping(&'a PatternMatchMapping)
MatchClass(&'a PatternMatchClass)
MatchStar(&'a PatternMatchStar)
MatchAs(&'a PatternMatchAs)
MatchOr(&'a PatternMatchOr)
Implementations§
Source§impl<'a> PatternRef<'a>
impl<'a> PatternRef<'a>
Sourcepub const fn is_match_value(&self) -> bool
pub const fn is_match_value(&self) -> bool
Returns true if self is of variant MatchValue.
Sourcepub fn as_match_value(&self) -> Option<&&'a PatternMatchValue>
pub fn as_match_value(&self) -> Option<&&'a PatternMatchValue>
Returns Some if self is a reference of variant MatchValue, and None otherwise.
Sourcepub fn as_mut_match_value(&mut self) -> Option<&mut &'a PatternMatchValue>
pub fn as_mut_match_value(&mut self) -> Option<&mut &'a PatternMatchValue>
Returns Some if self is a mutable reference of variant MatchValue, and None otherwise.
Sourcepub fn expect_match_value(self) -> &'a PatternMatchValuewhere
Self: Debug,
pub fn expect_match_value(self) -> &'a PatternMatchValuewhere
Self: Debug,
Unwraps the value, yielding the content of MatchValue.
§Panics
Panics if the value is not MatchValue, with a panic message including the content of self.
Sourcepub fn match_value(self) -> Option<&'a PatternMatchValue>
pub fn match_value(self) -> Option<&'a PatternMatchValue>
Returns Some if self is of variant MatchValue, and None otherwise.
Sourcepub const fn is_match_singleton(&self) -> bool
pub const fn is_match_singleton(&self) -> bool
Returns true if self is of variant MatchSingleton.
Sourcepub fn as_match_singleton(&self) -> Option<&&'a PatternMatchSingleton>
pub fn as_match_singleton(&self) -> Option<&&'a PatternMatchSingleton>
Returns Some if self is a reference of variant MatchSingleton, and None otherwise.
Sourcepub fn as_mut_match_singleton(
&mut self,
) -> Option<&mut &'a PatternMatchSingleton>
pub fn as_mut_match_singleton( &mut self, ) -> Option<&mut &'a PatternMatchSingleton>
Returns Some if self is a mutable reference of variant MatchSingleton, and None otherwise.
Sourcepub fn expect_match_singleton(self) -> &'a PatternMatchSingletonwhere
Self: Debug,
pub fn expect_match_singleton(self) -> &'a PatternMatchSingletonwhere
Self: Debug,
Unwraps the value, yielding the content of MatchSingleton.
§Panics
Panics if the value is not MatchSingleton, with a panic message including the content of self.
Sourcepub fn match_singleton(self) -> Option<&'a PatternMatchSingleton>
pub fn match_singleton(self) -> Option<&'a PatternMatchSingleton>
Returns Some if self is of variant MatchSingleton, and None otherwise.
Sourcepub const fn is_match_sequence(&self) -> bool
pub const fn is_match_sequence(&self) -> bool
Returns true if self is of variant MatchSequence.
Sourcepub fn as_match_sequence(&self) -> Option<&&'a PatternMatchSequence>
pub fn as_match_sequence(&self) -> Option<&&'a PatternMatchSequence>
Returns Some if self is a reference of variant MatchSequence, and None otherwise.
Sourcepub fn as_mut_match_sequence(&mut self) -> Option<&mut &'a PatternMatchSequence>
pub fn as_mut_match_sequence(&mut self) -> Option<&mut &'a PatternMatchSequence>
Returns Some if self is a mutable reference of variant MatchSequence, and None otherwise.
Sourcepub fn expect_match_sequence(self) -> &'a PatternMatchSequencewhere
Self: Debug,
pub fn expect_match_sequence(self) -> &'a PatternMatchSequencewhere
Self: Debug,
Unwraps the value, yielding the content of MatchSequence.
§Panics
Panics if the value is not MatchSequence, with a panic message including the content of self.
Sourcepub fn match_sequence(self) -> Option<&'a PatternMatchSequence>
pub fn match_sequence(self) -> Option<&'a PatternMatchSequence>
Returns Some if self is of variant MatchSequence, and None otherwise.
Sourcepub const fn is_match_mapping(&self) -> bool
pub const fn is_match_mapping(&self) -> bool
Returns true if self is of variant MatchMapping.
Sourcepub fn as_match_mapping(&self) -> Option<&&'a PatternMatchMapping>
pub fn as_match_mapping(&self) -> Option<&&'a PatternMatchMapping>
Returns Some if self is a reference of variant MatchMapping, and None otherwise.
Sourcepub fn as_mut_match_mapping(&mut self) -> Option<&mut &'a PatternMatchMapping>
pub fn as_mut_match_mapping(&mut self) -> Option<&mut &'a PatternMatchMapping>
Returns Some if self is a mutable reference of variant MatchMapping, and None otherwise.
Sourcepub fn expect_match_mapping(self) -> &'a PatternMatchMappingwhere
Self: Debug,
pub fn expect_match_mapping(self) -> &'a PatternMatchMappingwhere
Self: Debug,
Unwraps the value, yielding the content of MatchMapping.
§Panics
Panics if the value is not MatchMapping, with a panic message including the content of self.
Sourcepub fn match_mapping(self) -> Option<&'a PatternMatchMapping>
pub fn match_mapping(self) -> Option<&'a PatternMatchMapping>
Returns Some if self is of variant MatchMapping, and None otherwise.
Sourcepub const fn is_match_class(&self) -> bool
pub const fn is_match_class(&self) -> bool
Returns true if self is of variant MatchClass.
Sourcepub fn as_match_class(&self) -> Option<&&'a PatternMatchClass>
pub fn as_match_class(&self) -> Option<&&'a PatternMatchClass>
Returns Some if self is a reference of variant MatchClass, and None otherwise.
Sourcepub fn as_mut_match_class(&mut self) -> Option<&mut &'a PatternMatchClass>
pub fn as_mut_match_class(&mut self) -> Option<&mut &'a PatternMatchClass>
Returns Some if self is a mutable reference of variant MatchClass, and None otherwise.
Sourcepub fn expect_match_class(self) -> &'a PatternMatchClasswhere
Self: Debug,
pub fn expect_match_class(self) -> &'a PatternMatchClasswhere
Self: Debug,
Unwraps the value, yielding the content of MatchClass.
§Panics
Panics if the value is not MatchClass, with a panic message including the content of self.
Sourcepub fn match_class(self) -> Option<&'a PatternMatchClass>
pub fn match_class(self) -> Option<&'a PatternMatchClass>
Returns Some if self is of variant MatchClass, and None otherwise.
Sourcepub const fn is_match_star(&self) -> bool
pub const fn is_match_star(&self) -> bool
Returns true if self is of variant MatchStar.
Sourcepub fn as_match_star(&self) -> Option<&&'a PatternMatchStar>
pub fn as_match_star(&self) -> Option<&&'a PatternMatchStar>
Returns Some if self is a reference of variant MatchStar, and None otherwise.
Sourcepub fn as_mut_match_star(&mut self) -> Option<&mut &'a PatternMatchStar>
pub fn as_mut_match_star(&mut self) -> Option<&mut &'a PatternMatchStar>
Returns Some if self is a mutable reference of variant MatchStar, and None otherwise.
Sourcepub fn expect_match_star(self) -> &'a PatternMatchStarwhere
Self: Debug,
pub fn expect_match_star(self) -> &'a PatternMatchStarwhere
Self: Debug,
Sourcepub fn match_star(self) -> Option<&'a PatternMatchStar>
pub fn match_star(self) -> Option<&'a PatternMatchStar>
Returns Some if self is of variant MatchStar, and None otherwise.
Sourcepub const fn is_match_as(&self) -> bool
pub const fn is_match_as(&self) -> bool
Returns true if self is of variant MatchAs.
Sourcepub fn as_match_as(&self) -> Option<&&'a PatternMatchAs>
pub fn as_match_as(&self) -> Option<&&'a PatternMatchAs>
Returns Some if self is a reference of variant MatchAs, and None otherwise.
Sourcepub fn as_mut_match_as(&mut self) -> Option<&mut &'a PatternMatchAs>
pub fn as_mut_match_as(&mut self) -> Option<&mut &'a PatternMatchAs>
Returns Some if self is a mutable reference of variant MatchAs, and None otherwise.
Sourcepub fn expect_match_as(self) -> &'a PatternMatchAswhere
Self: Debug,
pub fn expect_match_as(self) -> &'a PatternMatchAswhere
Self: Debug,
Sourcepub fn match_as(self) -> Option<&'a PatternMatchAs>
pub fn match_as(self) -> Option<&'a PatternMatchAs>
Returns Some if self is of variant MatchAs, and None otherwise.
Sourcepub const fn is_match_or(&self) -> bool
pub const fn is_match_or(&self) -> bool
Returns true if self is of variant MatchOr.
Sourcepub fn as_match_or(&self) -> Option<&&'a PatternMatchOr>
pub fn as_match_or(&self) -> Option<&&'a PatternMatchOr>
Returns Some if self is a reference of variant MatchOr, and None otherwise.
Sourcepub fn as_mut_match_or(&mut self) -> Option<&mut &'a PatternMatchOr>
pub fn as_mut_match_or(&mut self) -> Option<&mut &'a PatternMatchOr>
Returns Some if self is a mutable reference of variant MatchOr, and None otherwise.
Sourcepub fn expect_match_or(self) -> &'a PatternMatchOrwhere
Self: Debug,
pub fn expect_match_or(self) -> &'a PatternMatchOrwhere
Self: Debug,
Sourcepub fn match_or(self) -> Option<&'a PatternMatchOr>
pub fn match_or(self) -> Option<&'a PatternMatchOr>
Returns Some if self is of variant MatchOr, and None otherwise.
Trait Implementations§
Source§impl<'a> Clone for PatternRef<'a>
impl<'a> Clone for PatternRef<'a>
Source§fn clone(&self) -> PatternRef<'a>
fn clone(&self) -> PatternRef<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for PatternRef<'a>
impl<'a> Debug for PatternRef<'a>
Source§impl<'a> From<&'a Pattern> for PatternRef<'a>
impl<'a> From<&'a Pattern> for PatternRef<'a>
Source§impl<'a> From<&'a PatternMatchAs> for PatternRef<'a>
impl<'a> From<&'a PatternMatchAs> for PatternRef<'a>
Source§fn from(node: &'a PatternMatchAs) -> Self
fn from(node: &'a PatternMatchAs) -> Self
Source§impl<'a> From<&'a PatternMatchClass> for PatternRef<'a>
impl<'a> From<&'a PatternMatchClass> for PatternRef<'a>
Source§fn from(node: &'a PatternMatchClass) -> Self
fn from(node: &'a PatternMatchClass) -> Self
Source§impl<'a> From<&'a PatternMatchMapping> for PatternRef<'a>
impl<'a> From<&'a PatternMatchMapping> for PatternRef<'a>
Source§fn from(node: &'a PatternMatchMapping) -> Self
fn from(node: &'a PatternMatchMapping) -> Self
Source§impl<'a> From<&'a PatternMatchOr> for PatternRef<'a>
impl<'a> From<&'a PatternMatchOr> for PatternRef<'a>
Source§fn from(node: &'a PatternMatchOr) -> Self
fn from(node: &'a PatternMatchOr) -> Self
Source§impl<'a> From<&'a PatternMatchSequence> for PatternRef<'a>
impl<'a> From<&'a PatternMatchSequence> for PatternRef<'a>
Source§fn from(node: &'a PatternMatchSequence) -> Self
fn from(node: &'a PatternMatchSequence) -> Self
Source§impl<'a> From<&'a PatternMatchSingleton> for PatternRef<'a>
impl<'a> From<&'a PatternMatchSingleton> for PatternRef<'a>
Source§fn from(node: &'a PatternMatchSingleton) -> Self
fn from(node: &'a PatternMatchSingleton) -> Self
Source§impl<'a> From<&'a PatternMatchStar> for PatternRef<'a>
impl<'a> From<&'a PatternMatchStar> for PatternRef<'a>
Source§fn from(node: &'a PatternMatchStar) -> Self
fn from(node: &'a PatternMatchStar) -> Self
Source§impl<'a> From<&'a PatternMatchValue> for PatternRef<'a>
impl<'a> From<&'a PatternMatchValue> for PatternRef<'a>
Source§fn from(node: &'a PatternMatchValue) -> Self
fn from(node: &'a PatternMatchValue) -> Self
Source§impl<'a> From<PatternRef<'a>> for AnyNodeRef<'a>
impl<'a> From<PatternRef<'a>> for AnyNodeRef<'a>
Source§fn from(node: PatternRef<'a>) -> AnyNodeRef<'a>
fn from(node: PatternRef<'a>) -> AnyNodeRef<'a>
Source§impl HasNodeIndex for PatternRef<'_>
impl HasNodeIndex for PatternRef<'_>
Source§fn node_index(&self) -> &AtomicNodeIndex
fn node_index(&self) -> &AtomicNodeIndex
AtomicNodeIndex for this node.Source§impl<'a> PartialEq for PatternRef<'a>
impl<'a> PartialEq for PatternRef<'a>
Source§impl Ranged for PatternRef<'_>
impl Ranged for PatternRef<'_>
impl<'a> Copy for PatternRef<'a>
impl<'a> StructuralPartialEq for PatternRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for PatternRef<'a>
impl<'a> RefUnwindSafe for PatternRef<'a>
impl<'a> Send for PatternRef<'a>
impl<'a> Sync for PatternRef<'a>
impl<'a> Unpin for PatternRef<'a>
impl<'a> UnsafeUnpin for PatternRef<'a>
impl<'a> UnwindSafe for PatternRef<'a>
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
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>
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>
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