pub struct LevelHistogram { /* private fields */ }
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.
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 more