pub struct Id<T: ?Sized + SpecId<A>, A> { /* private fields */ }
Expand description
A unique identifier for an object allocated using Arena
.
Id<T, A>
can only be used with the specific arena from which it was created,
thanks to the type parameter A
, which uniquely identifies the arena.
An Id<T, A>
guarantees that calling Arena::get
with it will always yield
a reference to the same object (bitwise identical), unless the object is
explicitly mutated via a mutable reference obtained from Arena::get_mut
.
The object associated with this Id
is guaranteed to have the same lifetime
as the arena itself, meaning it remains valid as long as the arena exists.
Implementations§
Trait Implementations§
impl<T: ?Sized + SpecId<A>, A> Copy for Id<T, A>
impl<T: ?Sized + SpecId<A>, A> Eq for Id<T, A>
Auto Trait Implementations§
impl<T, A> Freeze for Id<T, A>
impl<T, A> RefUnwindSafe for Id<T, A>where
<T as SpecId<A>>::Id: RefUnwindSafe,
T: ?Sized,
impl<T, A> Send for Id<T, A>
impl<T, A> Sync for Id<T, A>
impl<T, A> Unpin for Id<T, A>
impl<T, A> UnwindSafe for Id<T, A>where
<T as SpecId<A>>::Id: UnwindSafe,
T: ?Sized,
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