pub struct Id<T> { /* private fields */ }Expand description
A stable generational handle into an Arena<T>.
指向 Arena<T> 的稳定代际句柄。
An Id is two packed integers (slot index + generation) and never stores a reference, so it can outlive the arena without dangling.
Id 由两个打包的整数(槽位索引 + 代际)组成,且从不存储引用,因此可以比 arena 存活更久而不会悬垂。
Once a slot is removed, its generation advances, invalidating all previously issued Ids.
一旦槽位被移除,其代际就会递增,从而使所有先前发出的 Id 失效。
The T parameter is phantom: it exists only to make IDs of different arenas distinct types at compile time.
T 参数是幻影的:它仅用于让不同 arena 的 ID 在编译期成为不同的类型。
Trait impls are written by hand so that Id<T> is always Copy/Eq/Hash regardless of T.
特质实现均为手写,以便无论 T 为何,Id<T> 始终是 Copy/Eq/Hash。
Implementations§
Trait Implementations§
impl<T> Copy for Id<T>
impl<T> Eq for Id<T>
Source§impl<T> Ord for Id<T>
impl<T> Ord for Id<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Auto Trait Implementations§
impl<T> Freeze for Id<T>
impl<T> RefUnwindSafe for Id<T>
impl<T> Send for Id<T>
impl<T> Sync for Id<T>
impl<T> Unpin for Id<T>
impl<T> UnsafeUnpin for Id<T>
impl<T> UnwindSafe for Id<T>
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