pub struct OffsetList {
pub smol: Vec<u32>,
pub chonk: Vec<u64>,
}
Expand description
A list of unsigned integers that uses u32
elements as long as they are small enough, and switches to u64
once they are not.
Fields§
§smol: Vec<u32>
Offsets that fit within a u32
.
chonk: Vec<u64>
Offsets that either do not fit in a u32
, or are inserted after some offset that did not fit.
Implementations§
Source§impl OffsetList
impl OffsetList
Sourcepub fn push(&mut self, offset: usize)
pub fn push(&mut self, offset: usize)
Inserts the offset, as a u32
if that is still on the table.
Sourcepub fn index(&self, index: usize) -> usize
pub fn index(&self, index: usize) -> usize
Like std::ops::Index
, which we cannot implement as it must return a &usize
.
Sourcepub fn set(&mut self, index: usize, offset: usize)
pub fn set(&mut self, index: usize, offset: usize)
Set the offset at location index.
Complicated if offset
does not fit into self.smol
.
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Allocate a new list with a specified capacity.
Trait Implementations§
Source§impl Abomonation for OffsetList
impl Abomonation for OffsetList
Source§impl Clone for OffsetList
impl Clone for OffsetList
Source§fn clone(&self) -> OffsetList
fn clone(&self) -> OffsetList
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for OffsetList
impl Debug for OffsetList
Source§impl Ord for OffsetList
impl Ord for OffsetList
Source§fn cmp(&self, other: &OffsetList) -> Ordering
fn cmp(&self, other: &OffsetList) -> Ordering
1.21.0 · 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
Source§impl PartialEq for OffsetList
impl PartialEq for OffsetList
Source§impl PartialOrd for OffsetList
impl PartialOrd for OffsetList
impl Eq for OffsetList
impl StructuralPartialEq for OffsetList
Auto Trait Implementations§
impl Freeze for OffsetList
impl RefUnwindSafe for OffsetList
impl Send for OffsetList
impl Sync for OffsetList
impl Unpin for OffsetList
impl UnwindSafe for OffsetList
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