pub enum LiteralExpressionRef<'a> {
StringLiteral(&'a ExprStringLiteral),
BytesLiteral(&'a ExprBytesLiteral),
NumberLiteral(&'a ExprNumberLiteral),
BooleanLiteral(&'a ExprBooleanLiteral),
NoneLiteral(&'a ExprNoneLiteral),
EllipsisLiteral(&'a ExprEllipsisLiteral),
}Expand description
Unowned pendant to all the literal variants of ast::Expr that stores a
reference instead of an owned value.
Variants§
StringLiteral(&'a ExprStringLiteral)
BytesLiteral(&'a ExprBytesLiteral)
NumberLiteral(&'a ExprNumberLiteral)
BooleanLiteral(&'a ExprBooleanLiteral)
NoneLiteral(&'a ExprNoneLiteral)
EllipsisLiteral(&'a ExprEllipsisLiteral)
Implementations§
Source§impl<'a> LiteralExpressionRef<'a>
impl<'a> LiteralExpressionRef<'a>
Sourcepub const fn is_string_literal(&self) -> bool
pub const fn is_string_literal(&self) -> bool
Returns true if self is of variant StringLiteral.
Sourcepub fn as_string_literal(&self) -> Option<&&'a ExprStringLiteral>
pub fn as_string_literal(&self) -> Option<&&'a ExprStringLiteral>
Returns Some if self is a reference of variant StringLiteral, and None otherwise.
Sourcepub fn as_mut_string_literal(&mut self) -> Option<&mut &'a ExprStringLiteral>
pub fn as_mut_string_literal(&mut self) -> Option<&mut &'a ExprStringLiteral>
Returns Some if self is a mutable reference of variant StringLiteral, and None otherwise.
Sourcepub fn expect_string_literal(self) -> &'a ExprStringLiteralwhere
Self: Debug,
pub fn expect_string_literal(self) -> &'a ExprStringLiteralwhere
Self: Debug,
Unwraps the value, yielding the content of StringLiteral.
§Panics
Panics if the value is not StringLiteral, with a panic message including the content of self.
Sourcepub fn string_literal(self) -> Option<&'a ExprStringLiteral>
pub fn string_literal(self) -> Option<&'a ExprStringLiteral>
Returns Some if self is of variant StringLiteral, and None otherwise.
Sourcepub const fn is_bytes_literal(&self) -> bool
pub const fn is_bytes_literal(&self) -> bool
Returns true if self is of variant BytesLiteral.
Sourcepub fn as_bytes_literal(&self) -> Option<&&'a ExprBytesLiteral>
pub fn as_bytes_literal(&self) -> Option<&&'a ExprBytesLiteral>
Returns Some if self is a reference of variant BytesLiteral, and None otherwise.
Sourcepub fn as_mut_bytes_literal(&mut self) -> Option<&mut &'a ExprBytesLiteral>
pub fn as_mut_bytes_literal(&mut self) -> Option<&mut &'a ExprBytesLiteral>
Returns Some if self is a mutable reference of variant BytesLiteral, and None otherwise.
Sourcepub fn expect_bytes_literal(self) -> &'a ExprBytesLiteralwhere
Self: Debug,
pub fn expect_bytes_literal(self) -> &'a ExprBytesLiteralwhere
Self: Debug,
Unwraps the value, yielding the content of BytesLiteral.
§Panics
Panics if the value is not BytesLiteral, with a panic message including the content of self.
Sourcepub fn bytes_literal(self) -> Option<&'a ExprBytesLiteral>
pub fn bytes_literal(self) -> Option<&'a ExprBytesLiteral>
Returns Some if self is of variant BytesLiteral, and None otherwise.
Sourcepub const fn is_number_literal(&self) -> bool
pub const fn is_number_literal(&self) -> bool
Returns true if self is of variant NumberLiteral.
Sourcepub fn as_number_literal(&self) -> Option<&&'a ExprNumberLiteral>
pub fn as_number_literal(&self) -> Option<&&'a ExprNumberLiteral>
Returns Some if self is a reference of variant NumberLiteral, and None otherwise.
Sourcepub fn as_mut_number_literal(&mut self) -> Option<&mut &'a ExprNumberLiteral>
pub fn as_mut_number_literal(&mut self) -> Option<&mut &'a ExprNumberLiteral>
Returns Some if self is a mutable reference of variant NumberLiteral, and None otherwise.
Sourcepub fn expect_number_literal(self) -> &'a ExprNumberLiteralwhere
Self: Debug,
pub fn expect_number_literal(self) -> &'a ExprNumberLiteralwhere
Self: Debug,
Unwraps the value, yielding the content of NumberLiteral.
§Panics
Panics if the value is not NumberLiteral, with a panic message including the content of self.
Sourcepub fn number_literal(self) -> Option<&'a ExprNumberLiteral>
pub fn number_literal(self) -> Option<&'a ExprNumberLiteral>
Returns Some if self is of variant NumberLiteral, and None otherwise.
Sourcepub const fn is_boolean_literal(&self) -> bool
pub const fn is_boolean_literal(&self) -> bool
Returns true if self is of variant BooleanLiteral.
Sourcepub fn as_boolean_literal(&self) -> Option<&&'a ExprBooleanLiteral>
pub fn as_boolean_literal(&self) -> Option<&&'a ExprBooleanLiteral>
Returns Some if self is a reference of variant BooleanLiteral, and None otherwise.
Sourcepub fn as_mut_boolean_literal(&mut self) -> Option<&mut &'a ExprBooleanLiteral>
pub fn as_mut_boolean_literal(&mut self) -> Option<&mut &'a ExprBooleanLiteral>
Returns Some if self is a mutable reference of variant BooleanLiteral, and None otherwise.
Sourcepub fn expect_boolean_literal(self) -> &'a ExprBooleanLiteralwhere
Self: Debug,
pub fn expect_boolean_literal(self) -> &'a ExprBooleanLiteralwhere
Self: Debug,
Unwraps the value, yielding the content of BooleanLiteral.
§Panics
Panics if the value is not BooleanLiteral, with a panic message including the content of self.
Sourcepub fn boolean_literal(self) -> Option<&'a ExprBooleanLiteral>
pub fn boolean_literal(self) -> Option<&'a ExprBooleanLiteral>
Returns Some if self is of variant BooleanLiteral, and None otherwise.
Sourcepub const fn is_none_literal(&self) -> bool
pub const fn is_none_literal(&self) -> bool
Returns true if self is of variant NoneLiteral.
Sourcepub fn as_none_literal(&self) -> Option<&&'a ExprNoneLiteral>
pub fn as_none_literal(&self) -> Option<&&'a ExprNoneLiteral>
Returns Some if self is a reference of variant NoneLiteral, and None otherwise.
Sourcepub fn as_mut_none_literal(&mut self) -> Option<&mut &'a ExprNoneLiteral>
pub fn as_mut_none_literal(&mut self) -> Option<&mut &'a ExprNoneLiteral>
Returns Some if self is a mutable reference of variant NoneLiteral, and None otherwise.
Sourcepub fn expect_none_literal(self) -> &'a ExprNoneLiteralwhere
Self: Debug,
pub fn expect_none_literal(self) -> &'a ExprNoneLiteralwhere
Self: Debug,
Unwraps the value, yielding the content of NoneLiteral.
§Panics
Panics if the value is not NoneLiteral, with a panic message including the content of self.
Sourcepub fn none_literal(self) -> Option<&'a ExprNoneLiteral>
pub fn none_literal(self) -> Option<&'a ExprNoneLiteral>
Returns Some if self is of variant NoneLiteral, and None otherwise.
Sourcepub const fn is_ellipsis_literal(&self) -> bool
pub const fn is_ellipsis_literal(&self) -> bool
Returns true if self is of variant EllipsisLiteral.
Sourcepub fn as_ellipsis_literal(&self) -> Option<&&'a ExprEllipsisLiteral>
pub fn as_ellipsis_literal(&self) -> Option<&&'a ExprEllipsisLiteral>
Returns Some if self is a reference of variant EllipsisLiteral, and None otherwise.
Sourcepub fn as_mut_ellipsis_literal(
&mut self,
) -> Option<&mut &'a ExprEllipsisLiteral>
pub fn as_mut_ellipsis_literal( &mut self, ) -> Option<&mut &'a ExprEllipsisLiteral>
Returns Some if self is a mutable reference of variant EllipsisLiteral, and None otherwise.
Sourcepub fn expect_ellipsis_literal(self) -> &'a ExprEllipsisLiteralwhere
Self: Debug,
pub fn expect_ellipsis_literal(self) -> &'a ExprEllipsisLiteralwhere
Self: Debug,
Unwraps the value, yielding the content of EllipsisLiteral.
§Panics
Panics if the value is not EllipsisLiteral, with a panic message including the content of self.
Sourcepub fn ellipsis_literal(self) -> Option<&'a ExprEllipsisLiteral>
pub fn ellipsis_literal(self) -> Option<&'a ExprEllipsisLiteral>
Returns Some if self is of variant EllipsisLiteral, and None otherwise.
Source§impl LiteralExpressionRef<'_>
impl LiteralExpressionRef<'_>
Sourcepub fn is_implicit_concatenated(&self) -> bool
pub fn is_implicit_concatenated(&self) -> bool
Returns true if the literal is either a string or bytes literal that
is implicitly concatenated.
Trait Implementations§
Source§impl<'a> Clone for LiteralExpressionRef<'a>
impl<'a> Clone for LiteralExpressionRef<'a>
Source§fn clone(&self) -> LiteralExpressionRef<'a>
fn clone(&self) -> LiteralExpressionRef<'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 LiteralExpressionRef<'a>
impl<'a> Debug for LiteralExpressionRef<'a>
Source§impl<'a> From<LiteralExpressionRef<'a>> for AnyNodeRef<'a>
impl<'a> From<LiteralExpressionRef<'a>> for AnyNodeRef<'a>
Source§fn from(value: LiteralExpressionRef<'a>) -> Self
fn from(value: LiteralExpressionRef<'a>) -> Self
Source§impl<'a> From<LiteralExpressionRef<'a>> for ComparableLiteral<'a>
impl<'a> From<LiteralExpressionRef<'a>> for ComparableLiteral<'a>
Source§fn from(literal: LiteralExpressionRef<'a>) -> Self
fn from(literal: LiteralExpressionRef<'a>) -> Self
Source§impl<'a> PartialEq for LiteralExpressionRef<'a>
impl<'a> PartialEq for LiteralExpressionRef<'a>
Source§impl Ranged for LiteralExpressionRef<'_>
impl Ranged for LiteralExpressionRef<'_>
impl<'a> Copy for LiteralExpressionRef<'a>
impl<'a> StructuralPartialEq for LiteralExpressionRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for LiteralExpressionRef<'a>
impl<'a> RefUnwindSafe for LiteralExpressionRef<'a>
impl<'a> Send for LiteralExpressionRef<'a>
impl<'a> Sync for LiteralExpressionRef<'a>
impl<'a> Unpin for LiteralExpressionRef<'a>
impl<'a> UnsafeUnpin for LiteralExpressionRef<'a>
impl<'a> UnwindSafe for LiteralExpressionRef<'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