pub struct RowIdSequence(/* private fields */);Expand description
A sequence of row ids.
Row ids are u64s that:
- Are unique within a table (except for tombstones)
- Are often but not always sorted and/or contiguous.
This sequence of row ids is optimized to be compact when the row ids are contiguous and sorted. However, it does not require that the row ids are contiguous or sorted.
We can make optimizations that assume uniqueness.
Implementations§
Source§impl RowIdSequence
impl RowIdSequence
pub fn new() -> Self
pub fn iter(&self) -> impl DoubleEndedIterator<Item = u64> + '_
pub fn len(&self) -> u64
pub fn is_empty(&self) -> bool
Sourcepub fn extend(&mut self, other: Self)
pub fn extend(&mut self, other: Self)
Combines this row id sequence with another row id sequence.
Sourcepub fn delete(&mut self, row_ids: impl IntoIterator<Item = u64>)
pub fn delete(&mut self, row_ids: impl IntoIterator<Item = u64>)
Remove a set of row ids from the sequence.
Sourcepub fn mask(&mut self, positions: impl IntoIterator<Item = u32>) -> Result<()>
pub fn mask(&mut self, positions: impl IntoIterator<Item = u32>) -> Result<()>
Delete row ids by position.
pub fn slice(&self, offset: usize, len: usize) -> RowIdSeqSlice<'_>
Sourcepub fn get(&self, index: usize) -> Option<u64>
pub fn get(&self, index: usize) -> Option<u64>
Get the row id at the given index.
If the index is out of bounds, this will return None.
Sourcepub fn select<'a>(
&'a self,
selection: impl Iterator<Item = usize> + 'a,
) -> impl Iterator<Item = u64> + 'a
pub fn select<'a>( &'a self, selection: impl Iterator<Item = usize> + 'a, ) -> impl Iterator<Item = u64> + 'a
Get row ids from the sequence based on the provided sorted offsets
Any out of bounds offsets will be ignored
§Panics
If the input selection is not sorted, this function will panic
Sourcepub fn mask_to_offset_ranges(&self, mask: &RowIdMask) -> Vec<Range<u64>>
pub fn mask_to_offset_ranges(&self, mask: &RowIdMask) -> Vec<Range<u64>>
Given a mask of row ids, calculate the offset ranges of the row ids that are present in the sequence.
For example, given a mask that selects all even ids and a sequence that is [80..85, 86..90, 14]
this will return [0, 2, 4, 5, 7, 9] because the range expands to
[80, 81, 82, 83, 84, 86, 87, 88, 89, 14] with offsets [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
This function is useful when determining which row offsets to read from a fragment given a mask.
Trait Implementations§
Source§impl Clone for RowIdSequence
impl Clone for RowIdSequence
Source§fn clone(&self) -> RowIdSequence
fn clone(&self) -> RowIdSequence
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RowIdSequence
impl Debug for RowIdSequence
Source§impl DeepSizeOf for RowIdSequence
impl DeepSizeOf for RowIdSequence
Source§fn deep_size_of_children(&self, context: &mut Context) -> usize
fn deep_size_of_children(&self, context: &mut Context) -> usize
Source§fn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
Source§impl Default for RowIdSequence
impl Default for RowIdSequence
Source§fn default() -> RowIdSequence
fn default() -> RowIdSequence
Source§impl Display for RowIdSequence
impl Display for RowIdSequence
Source§impl From<&[u64]> for RowIdSequence
impl From<&[u64]> for RowIdSequence
Source§impl From<&RowIdSequence> for RowIdTreeMap
impl From<&RowIdSequence> for RowIdTreeMap
Source§fn from(row_ids: &RowIdSequence) -> Self
fn from(row_ids: &RowIdSequence) -> Self
Source§impl From<RowIdSequence> for RowIdSequence
impl From<RowIdSequence> for RowIdSequence
Source§fn from(sequence: RowIdSequence) -> Self
fn from(sequence: RowIdSequence) -> Self
Source§impl PartialEq for RowIdSequence
impl PartialEq for RowIdSequence
Source§impl TryFrom<RowIdSequence> for RowIdSequence
impl TryFrom<RowIdSequence> for RowIdSequence
impl Eq for RowIdSequence
impl StructuralPartialEq for RowIdSequence
Auto Trait Implementations§
impl Freeze for RowIdSequence
impl RefUnwindSafe for RowIdSequence
impl Send for RowIdSequence
impl Sync for RowIdSequence
impl Unpin for RowIdSequence
impl UnwindSafe for RowIdSequence
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.