Skip to main content

RepetitionLevelDecoderImpl

Struct RepetitionLevelDecoderImpl 

Source
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: bool

Whether the levels read so far end with a record that has not ended yet

Implementations§

Source§

impl RepetitionLevelDecoderImpl

Source

pub fn new(max_level: i16) -> Self

Source

fn fill_buf(&mut self) -> Result<()>

Source

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), partial is false and levels_read is the number of levels in the requested records, so the 0 that starts the next record is left unread.
  • Otherwise partial is true and levels_read is the number of levels inspected. The last record in those levels has not ended yet, and is not counted in records_read.

Trait Implementations§

Source§

impl ColumnLevelDecoder for RepetitionLevelDecoderImpl

Source§

type Buffer = Vec<i16>

Source§

fn set_data(&mut self, encoding: Encoding, data: Bytes) -> Result<()>

Set data for this ColumnLevelDecoder
Source§

impl RepetitionLevelDecoder for RepetitionLevelDecoderImpl

Source§

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 more
Source§

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 more
Source§

fn flush_partial(&mut self) -> bool

Flush any partially read or skipped record. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Ungil for T
where T: Send,