pub struct LevelHistogram {
inner: Vec<i64>,
}
Expand description
Histograms for repetition and definition levels.
Each histogram is a vector of length max_level + 1
. The value at index i
is the number of
values at level i
.
For example, vec[0]
is the number of rows with level 0, vec[1]
is the
number of rows with level 1, and so on.
Fields§
§inner: Vec<i64>
Implementations§
Source§impl LevelHistogram
impl LevelHistogram
Sourcepub fn try_new(max_level: i16) -> Option<Self>
pub fn try_new(max_level: i16) -> Option<Self>
Creates a new level histogram data.
Length will be max_level + 1
.
Returns None
when max_level == 0
(because histograms are not necessary in this case)
Sourcepub fn into_inner(self) -> Vec<i64>
pub fn into_inner(self) -> Vec<i64>
Return the inner vector, consuming self
Sourcepub fn get(&self, index: usize) -> Option<i64>
pub fn get(&self, index: usize) -> Option<i64>
Returns the histogram value at the given index.
The value of i
is the number of values with level i
. For example,
get(1)
returns the number of values with level 1.
Returns None
if the index is out of bounds.
Sourcepub fn add(&mut self, other: &Self)
pub fn add(&mut self, other: &Self)
Adds the values from the other histogram to this histogram
§Panics
If the histograms have different lengths
Sourcepub fn update_from_levels(&mut self, levels: &[i16])
pub fn update_from_levels(&mut self, levels: &[i16])
Updates histogram values using provided repetition levels
§Panics
if any of the levels is greater than the length of the histogram (
the argument supplied to Self::try_new
)
Trait Implementations§
Source§impl Clone for LevelHistogram
impl Clone for LevelHistogram
Source§fn clone(&self) -> LevelHistogram
fn clone(&self) -> LevelHistogram
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for LevelHistogram
impl Debug for LevelHistogram
Source§impl Default for LevelHistogram
impl Default for LevelHistogram
Source§fn default() -> LevelHistogram
fn default() -> LevelHistogram
Source§impl From<LevelHistogram> for Vec<i64>
impl From<LevelHistogram> for Vec<i64>
Source§fn from(value: LevelHistogram) -> Self
fn from(value: LevelHistogram) -> Self
Source§impl Hash for LevelHistogram
impl Hash for LevelHistogram
Source§impl HeapSize for LevelHistogram
impl HeapSize for LevelHistogram
Source§impl PartialEq for LevelHistogram
impl PartialEq for LevelHistogram
impl Eq for LevelHistogram
impl StructuralPartialEq for LevelHistogram
Auto Trait Implementations§
impl Freeze for LevelHistogram
impl RefUnwindSafe for LevelHistogram
impl Send for LevelHistogram
impl Sync for LevelHistogram
impl Unpin for LevelHistogram
impl UnwindSafe for LevelHistogram
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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 more