pub enum ModRef<'a> {
Module(&'a ModModule),
Expression(&'a ModExpression),
}Expand description
See also mod
Variants§
Module(&'a ModModule)
Expression(&'a ModExpression)
Implementations§
Source§impl<'a> ModRef<'a>
impl<'a> ModRef<'a>
Sourcepub fn as_module(&self) -> Option<&&'a ModModule>
pub fn as_module(&self) -> Option<&&'a ModModule>
Returns Some if self is a reference of variant Module, and None otherwise.
Sourcepub fn as_mut_module(&mut self) -> Option<&mut &'a ModModule>
pub fn as_mut_module(&mut self) -> Option<&mut &'a ModModule>
Returns Some if self is a mutable reference of variant Module, and None otherwise.
Sourcepub fn expect_module(self) -> &'a ModModulewhere
Self: Debug,
pub fn expect_module(self) -> &'a ModModulewhere
Self: Debug,
Sourcepub fn module(self) -> Option<&'a ModModule>
pub fn module(self) -> Option<&'a ModModule>
Returns Some if self is of variant Module, and None otherwise.
Sourcepub const fn is_expression(&self) -> bool
pub const fn is_expression(&self) -> bool
Returns true if self is of variant Expression.
Sourcepub fn as_expression(&self) -> Option<&&'a ModExpression>
pub fn as_expression(&self) -> Option<&&'a ModExpression>
Returns Some if self is a reference of variant Expression, and None otherwise.
Sourcepub fn as_mut_expression(&mut self) -> Option<&mut &'a ModExpression>
pub fn as_mut_expression(&mut self) -> Option<&mut &'a ModExpression>
Returns Some if self is a mutable reference of variant Expression, and None otherwise.
Sourcepub fn expect_expression(self) -> &'a ModExpressionwhere
Self: Debug,
pub fn expect_expression(self) -> &'a ModExpressionwhere
Self: Debug,
Unwraps the value, yielding the content of Expression.
§Panics
Panics if the value is not Expression, with a panic message including the content of self.
Sourcepub fn expression(self) -> Option<&'a ModExpression>
pub fn expression(self) -> Option<&'a ModExpression>
Returns Some if self is of variant Expression, and None otherwise.
Trait Implementations§
Source§impl<'a> From<&'a ModExpression> for ModRef<'a>
impl<'a> From<&'a ModExpression> for ModRef<'a>
Source§fn from(node: &'a ModExpression) -> Self
fn from(node: &'a ModExpression) -> Self
Converts to this type from the input type.
Source§impl<'a> From<ModRef<'a>> for AnyNodeRef<'a>
impl<'a> From<ModRef<'a>> for AnyNodeRef<'a>
Source§fn from(node: ModRef<'a>) -> AnyNodeRef<'a>
fn from(node: ModRef<'a>) -> AnyNodeRef<'a>
Converts to this type from the input type.
Source§impl HasNodeIndex for ModRef<'_>
impl HasNodeIndex for ModRef<'_>
Source§fn node_index(&self) -> &AtomicNodeIndex
fn node_index(&self) -> &AtomicNodeIndex
Returns the
AtomicNodeIndex for this node.impl<'a> Copy for ModRef<'a>
impl<'a> StructuralPartialEq for ModRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for ModRef<'a>
impl<'a> RefUnwindSafe for ModRef<'a>
impl<'a> Send for ModRef<'a>
impl<'a> Sync for ModRef<'a>
impl<'a> Unpin for ModRef<'a>
impl<'a> UnsafeUnpin for ModRef<'a>
impl<'a> UnwindSafe for ModRef<'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
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