pub struct SegList<T> { /* private fields */ }Expand description
Segmented list with cache-friendly segment sizes
Each segment’s capacity is calculated at runtime based on T’s size to fit within a cache line.
NOTE: T is allow to larger than CACHE_LINE_SIZE, in this case SegList will ensure at least 2
items in one segment. But when T larger than 128B, you should consider put T into Box.
Implementations§
Source§impl<T> SegList<T>
impl<T> SegList<T>
Sourcepub const fn segment_cap() -> usize
pub const fn segment_cap() -> usize
Get the capacity of each segment
Sourcepub fn iter(&self) -> SegListIter<'_, T> ⓘ
pub fn iter(&self) -> SegListIter<'_, T> ⓘ
Returns an iterator over the list
Sourcepub fn iter_mut(&mut self) -> SegListIterMut<'_, T> ⓘ
pub fn iter_mut(&mut self) -> SegListIterMut<'_, T> ⓘ
Returns a mutable iterator over the list
Sourcepub fn drain(self) -> SegListDrain<T> ⓘ
pub fn drain(self) -> SegListDrain<T> ⓘ
Returns a draining iterator that consumes the list and yields elements from head to tail
Trait Implementations§
Source§impl<T> IntoIterator for SegList<T>
impl<T> IntoIterator for SegList<T>
impl<T: Send> Send for SegList<T>
impl<T: Send> Sync for SegList<T>
Auto Trait Implementations§
impl<T> Freeze for SegList<T>
impl<T> RefUnwindSafe for SegList<T>
impl<T> Unpin for SegList<T>
impl<T> UnsafeUnpin for SegList<T>
impl<T> UnwindSafe for SegList<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