union Segment<T> {
children: ManuallyDrop<[Atomic<Segment<T>>; 1024]>,
elements: ManuallyDrop<[Atomic<T>; 1024]>,
}
Expand description
A fixed size array of atomic pointers to other Segment<T>
or T
.
Each segment is either an inner segment with pointers to other, children Segment<T>
or an
element segment with pointers to T
. This is determined by the height of this segment in the
main array, which one needs to track separately. For example, use the main array root’s tag.
Since destructing segments requires its height information, it is not recommended to implement
Drop
. Rather, implement and use the custom Segment::deallocate
method that accounts for
the height of the segment.
Fields§
§children: ManuallyDrop<[Atomic<Segment<T>>; 1024]>
§elements: ManuallyDrop<[Atomic<T>; 1024]>
Implementations§
Source§impl<T> Segment<T>
impl<T> Segment<T>
Sourcefn new() -> Owned<Self>
fn new() -> Owned<Self>
Create a new segment filled with null pointers. It is up to the callee to whether to use this as an intermediate or an element segment.
Sourceunsafe fn deallocate(self, height: usize)
unsafe fn deallocate(self, height: usize)
Deallocates a segment of height
.
§Safety
self
must actually have heightheight
.- There should be no other references to possible children segments.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Segment<T>
impl<T> RefUnwindSafe for Segment<T>where
T: RefUnwindSafe,
impl<T> Send for Segment<T>
impl<T> Sync for Segment<T>
impl<T> Unpin for Segment<T>
impl<T> UnwindSafe for Segment<T>where
T: RefUnwindSafe,
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