pub enum ItemRefMut<'ctx> {
Type(&'ctx mut TypeDecl),
Fun(&'ctx mut FunDecl),
Global(&'ctx mut GlobalDecl),
TraitDecl(&'ctx mut TraitDecl),
TraitImpl(&'ctx mut TraitImpl),
}Expand description
A mutable reference to a translated item.
Variants§
Type(&'ctx mut TypeDecl)
Fun(&'ctx mut FunDecl)
Global(&'ctx mut GlobalDecl)
TraitDecl(&'ctx mut TraitDecl)
TraitImpl(&'ctx mut TraitImpl)
Implementations§
Source§impl<'ctx> ItemRefMut<'ctx>
impl<'ctx> ItemRefMut<'ctx>
Sourcepub fn as_type_mut(&mut self) -> Option<&mut &'ctx mut TypeDecl>
pub fn as_type_mut(&mut self) -> Option<&mut &'ctx mut TypeDecl>
Optionally returns mutable references to the inner fields if this is a ItemRefMut::Type, otherwise None
Sourcepub fn as_type(&self) -> Option<&&'ctx mut TypeDecl>
pub fn as_type(&self) -> Option<&&'ctx mut TypeDecl>
Optionally returns references to the inner fields if this is a ItemRefMut::Type, otherwise None
Sourcepub fn into_type(self) -> Result<&'ctx mut TypeDecl, Self>
pub fn into_type(self) -> Result<&'ctx mut TypeDecl, Self>
Returns the inner fields if this is a ItemRefMut::Type, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_type_unchecked(self) -> &'ctx mut TypeDecl
pub unsafe fn into_type_unchecked(self) -> &'ctx mut TypeDecl
Unchecked return of the inner fields of ItemRefMut::Type.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_type_unchecked(&self) -> &&'ctx mut TypeDecl
pub unsafe fn as_type_unchecked(&self) -> &&'ctx mut TypeDecl
Unchecked reference of the inner fields of ItemRefMut::Type.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_type_mut_unchecked(&mut self) -> &mut &'ctx mut TypeDecl
pub unsafe fn as_type_mut_unchecked(&mut self) -> &mut &'ctx mut TypeDecl
Unchecked mutable reference of the inner fields of ItemRefMut::Type.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn as_fun_mut(&mut self) -> Option<&mut &'ctx mut FunDecl>
pub fn as_fun_mut(&mut self) -> Option<&mut &'ctx mut FunDecl>
Optionally returns mutable references to the inner fields if this is a ItemRefMut::Fun, otherwise None
Sourcepub fn as_fun(&self) -> Option<&&'ctx mut FunDecl>
pub fn as_fun(&self) -> Option<&&'ctx mut FunDecl>
Optionally returns references to the inner fields if this is a ItemRefMut::Fun, otherwise None
Sourcepub fn into_fun(self) -> Result<&'ctx mut FunDecl, Self>
pub fn into_fun(self) -> Result<&'ctx mut FunDecl, Self>
Returns the inner fields if this is a ItemRefMut::Fun, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_fun_unchecked(self) -> &'ctx mut FunDecl
pub unsafe fn into_fun_unchecked(self) -> &'ctx mut FunDecl
Unchecked return of the inner fields of ItemRefMut::Fun.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_fun_unchecked(&self) -> &&'ctx mut FunDecl
pub unsafe fn as_fun_unchecked(&self) -> &&'ctx mut FunDecl
Unchecked reference of the inner fields of ItemRefMut::Fun.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_fun_mut_unchecked(&mut self) -> &mut &'ctx mut FunDecl
pub unsafe fn as_fun_mut_unchecked(&mut self) -> &mut &'ctx mut FunDecl
Unchecked mutable reference of the inner fields of ItemRefMut::Fun.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn as_global_mut(&mut self) -> Option<&mut &'ctx mut GlobalDecl>
pub fn as_global_mut(&mut self) -> Option<&mut &'ctx mut GlobalDecl>
Optionally returns mutable references to the inner fields if this is a ItemRefMut::Global, otherwise None
Sourcepub fn as_global(&self) -> Option<&&'ctx mut GlobalDecl>
pub fn as_global(&self) -> Option<&&'ctx mut GlobalDecl>
Optionally returns references to the inner fields if this is a ItemRefMut::Global, otherwise None
Sourcepub fn into_global(self) -> Result<&'ctx mut GlobalDecl, Self>
pub fn into_global(self) -> Result<&'ctx mut GlobalDecl, Self>
Returns the inner fields if this is a ItemRefMut::Global, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_global_unchecked(self) -> &'ctx mut GlobalDecl
pub unsafe fn into_global_unchecked(self) -> &'ctx mut GlobalDecl
Unchecked return of the inner fields of ItemRefMut::Global.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_global_unchecked(&self) -> &&'ctx mut GlobalDecl
pub unsafe fn as_global_unchecked(&self) -> &&'ctx mut GlobalDecl
Unchecked reference of the inner fields of ItemRefMut::Global.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_global_mut_unchecked(&mut self) -> &mut &'ctx mut GlobalDecl
pub unsafe fn as_global_mut_unchecked(&mut self) -> &mut &'ctx mut GlobalDecl
Unchecked mutable reference of the inner fields of ItemRefMut::Global.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn is_trait_decl(&self) -> bool
pub fn is_trait_decl(&self) -> bool
Returns true if this is a ItemRefMut::TraitDecl, otherwise false
Sourcepub fn as_trait_decl_mut(&mut self) -> Option<&mut &'ctx mut TraitDecl>
pub fn as_trait_decl_mut(&mut self) -> Option<&mut &'ctx mut TraitDecl>
Optionally returns mutable references to the inner fields if this is a ItemRefMut::TraitDecl, otherwise None
Sourcepub fn as_trait_decl(&self) -> Option<&&'ctx mut TraitDecl>
pub fn as_trait_decl(&self) -> Option<&&'ctx mut TraitDecl>
Optionally returns references to the inner fields if this is a ItemRefMut::TraitDecl, otherwise None
Sourcepub fn into_trait_decl(self) -> Result<&'ctx mut TraitDecl, Self>
pub fn into_trait_decl(self) -> Result<&'ctx mut TraitDecl, Self>
Returns the inner fields if this is a ItemRefMut::TraitDecl, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_trait_decl_unchecked(self) -> &'ctx mut TraitDecl
pub unsafe fn into_trait_decl_unchecked(self) -> &'ctx mut TraitDecl
Unchecked return of the inner fields of ItemRefMut::TraitDecl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_decl_unchecked(&self) -> &&'ctx mut TraitDecl
pub unsafe fn as_trait_decl_unchecked(&self) -> &&'ctx mut TraitDecl
Unchecked reference of the inner fields of ItemRefMut::TraitDecl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_decl_mut_unchecked(&mut self) -> &mut &'ctx mut TraitDecl
pub unsafe fn as_trait_decl_mut_unchecked(&mut self) -> &mut &'ctx mut TraitDecl
Unchecked mutable reference of the inner fields of ItemRefMut::TraitDecl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub fn is_trait_impl(&self) -> bool
pub fn is_trait_impl(&self) -> bool
Returns true if this is a ItemRefMut::TraitImpl, otherwise false
Sourcepub fn as_trait_impl_mut(&mut self) -> Option<&mut &'ctx mut TraitImpl>
pub fn as_trait_impl_mut(&mut self) -> Option<&mut &'ctx mut TraitImpl>
Optionally returns mutable references to the inner fields if this is a ItemRefMut::TraitImpl, otherwise None
Sourcepub fn as_trait_impl(&self) -> Option<&&'ctx mut TraitImpl>
pub fn as_trait_impl(&self) -> Option<&&'ctx mut TraitImpl>
Optionally returns references to the inner fields if this is a ItemRefMut::TraitImpl, otherwise None
Sourcepub fn into_trait_impl(self) -> Result<&'ctx mut TraitImpl, Self>
pub fn into_trait_impl(self) -> Result<&'ctx mut TraitImpl, Self>
Returns the inner fields if this is a ItemRefMut::TraitImpl, otherwise returns back the enum in the Err case of the result
Sourcepub unsafe fn into_trait_impl_unchecked(self) -> &'ctx mut TraitImpl
pub unsafe fn into_trait_impl_unchecked(self) -> &'ctx mut TraitImpl
Unchecked return of the inner fields of ItemRefMut::TraitImpl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_impl_unchecked(&self) -> &&'ctx mut TraitImpl
pub unsafe fn as_trait_impl_unchecked(&self) -> &&'ctx mut TraitImpl
Unchecked reference of the inner fields of ItemRefMut::TraitImpl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Sourcepub unsafe fn as_trait_impl_mut_unchecked(&mut self) -> &mut &'ctx mut TraitImpl
pub unsafe fn as_trait_impl_mut_unchecked(&mut self) -> &mut &'ctx mut TraitImpl
Unchecked mutable reference of the inner fields of ItemRefMut::TraitImpl.
§Safety
Results in undefined behavior when it is the incorrect variant.
Source§impl<'ctx> ItemRefMut<'ctx>
impl<'ctx> ItemRefMut<'ctx>
pub fn as_ref(&self) -> ItemRef<'_>
pub fn reborrow(&mut self) -> ItemRefMut<'_>
pub fn set_id(&mut self, id: ItemId)
pub fn item_meta(&mut self) -> &mut ItemMeta
Sourcepub fn generic_params(&mut self) -> &mut GenericParams
pub fn generic_params(&mut self) -> &mut GenericParams
The generic parameters of this item.
Sourcepub fn drive_mut<V: VisitAstMut>(
&mut self,
visitor: &mut V,
) -> ControlFlow<V::Break>
pub fn drive_mut<V: VisitAstMut>( &mut self, visitor: &mut V, ) -> ControlFlow<V::Break>
We can’t implement AstVisitable because of the 'static constraint, but it’s ok because
ItemRefMut isn’t contained in any of our types.
Sourcepub fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))
pub fn dyn_visit_mut<T: AstVisitable>(&mut self, f: impl FnMut(&mut T))
Visit all occurrences of that type inside self, in pre-order traversal.
Trait Implementations§
Source§impl<'ctx> Debug for ItemRefMut<'ctx>
impl<'ctx> Debug for ItemRefMut<'ctx>
Source§impl<'ctx, 's, V> Drive<'s, V> for ItemRefMut<'ctx>
impl<'ctx, 's, V> Drive<'s, V> for ItemRefMut<'ctx>
Source§fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner(&'s self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit() on the immediate contents of self.Source§impl<'ctx, 's, V> DriveMut<'s, V> for ItemRefMut<'ctx>
impl<'ctx, 's, V> DriveMut<'s, V> for ItemRefMut<'ctx>
Source§fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
fn drive_inner_mut(&'s mut self, visitor: &mut V) -> ControlFlow<V::Break>
v.visit() on the immediate contents of self.Source§impl<'ctx, 's, V> DriveTwo<'s, V> for ItemRefMut<'ctx>
impl<'ctx, 's, V> DriveTwo<'s, V> for ItemRefMut<'ctx>
Source§fn drive_two_inner(
&'s self,
other: &'s Self,
visitor: &mut V,
) -> ControlFlow<V::Break>
fn drive_two_inner( &'s self, other: &'s Self, visitor: &mut V, ) -> ControlFlow<V::Break>
v.visit() on the immediate contents of self and other, if they correspond. If
the values don’t match up, this returns Break(Default::default()).Auto Trait Implementations§
impl<'ctx> !UnwindSafe for ItemRefMut<'ctx>
impl<'ctx> Freeze for ItemRefMut<'ctx>
impl<'ctx> RefUnwindSafe for ItemRefMut<'ctx>
impl<'ctx> Send for ItemRefMut<'ctx>
impl<'ctx> Sync for ItemRefMut<'ctx>
impl<'ctx> Unpin for ItemRefMut<'ctx>
impl<'ctx> UnsafeUnpin for ItemRefMut<'ctx>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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