pub struct RepetitionLevelDecoderImpl {
decoder: Option<LevelDecoder>,
bit_width: u8,
buffer: Box<[i16; 1024]>,
buffer_len: usize,
buffer_offset: usize,
has_partial: bool,
}Expand description
An implementation of RepetitionLevelDecoder for [i16]
Fields§
§decoder: Option<LevelDecoder>§bit_width: u8§buffer: Box<[i16; 1024]>§buffer_len: usize§buffer_offset: usize§has_partial: boolWhether the levels read so far end with a record that has not ended yet
Implementations§
Source§impl RepetitionLevelDecoderImpl
impl RepetitionLevelDecoderImpl
pub fn new(max_level: i16) -> Self
fn fill_buf(&mut self) -> Result<()>
Sourcefn count_records(
&self,
records_to_read: usize,
num_levels: usize,
) -> (bool, usize, usize)
fn count_records( &self, records_to_read: usize, num_levels: usize, ) -> (bool, usize, usize)
Counts the records that end within the unread levels in self.buffer,
looking at no more than num_levels of them and stopping once
records_to_read records have ended.
Each repetition level of 0 starts a new record, which ends the record
before it. If self.has_partial is set, the levels before the first 0
continue a record started by an earlier call.
Returns (partial, records_read, levels_read):
- If it finds the end of the last requested record
(
records_read == records_to_read),partialis false andlevels_readis the number of levels in the requested records, so the 0 that starts the next record is left unread. - Otherwise
partialis true andlevels_readis the number of levels inspected. The last record in those levels has not ended yet, and is not counted inrecords_read.
Trait Implementations§
Source§impl RepetitionLevelDecoder for RepetitionLevelDecoderImpl
impl RepetitionLevelDecoder for RepetitionLevelDecoderImpl
Source§fn read_rep_levels(
&mut self,
out: &mut Self::Buffer,
num_records: usize,
num_levels: usize,
) -> Result<(usize, usize)>
fn read_rep_levels( &mut self, out: &mut Self::Buffer, num_records: usize, num_levels: usize, ) -> Result<(usize, usize)>
Reads up to
num_records records, and at most num_levels levels, of repetition
level data into out, returning the number of complete records and levels read. Read moreSource§fn skip_rep_levels(
&mut self,
num_records: usize,
num_levels: usize,
) -> Result<(usize, usize)>
fn skip_rep_levels( &mut self, num_records: usize, num_levels: usize, ) -> Result<(usize, usize)>
Skips over up to
num_levels repetition levels corresponding to num_records
records, where a record is delimited by a repetition level of 0. Read moreSource§fn flush_partial(&mut self) -> bool
fn flush_partial(&mut self) -> bool
Flush any partially read or skipped record. Read more
Auto Trait Implementations§
impl !Freeze for RepetitionLevelDecoderImpl
impl RefUnwindSafe for RepetitionLevelDecoderImpl
impl Send for RepetitionLevelDecoderImpl
impl Sync for RepetitionLevelDecoderImpl
impl Unpin for RepetitionLevelDecoderImpl
impl UnsafeUnpin for RepetitionLevelDecoderImpl
impl UnwindSafe for RepetitionLevelDecoderImpl
Blanket Implementations§
impl<T> Allocation for T
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