Skip to content

Commit

Permalink
Add cppgc::InnerMember::get_mut (#1505)
Browse files Browse the repository at this point in the history
  • Loading branch information
littledivy committed Jun 22, 2024
1 parent 425862a commit a0dc5c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cppgc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ impl InnerMember {
pub unsafe fn get<T: GarbageCollected>(&self) -> &T {
unsafe { self.ptr.cast::<T>().as_ref().unwrap() }
}

pub unsafe fn get_mut<T: GarbageCollected>(&mut self) -> &mut T {
unsafe { self.ptr.cast::<T>().as_mut().unwrap() }
}
}

/// Members are used to contain strong pointers to other garbage
Expand Down

0 comments on commit a0dc5c1

Please sign in to comment.