Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder<R> { /* private fields */ }
Expand description

A decoder for a multiplexed YTsaurus Skiff input stream.

Implementations§

Source§

impl<R: Read> Decoder<R>

Source

pub fn new(input: R, format: Format) -> Self

Creates a decoder for rows described by format.

Source

pub fn with_max_blob_bytes(self, bytes: usize) -> Self

Changes the maximum string32 or yson32 payload this decoder accepts.

Source

pub fn with_max_row_bytes(self, bytes: usize) -> Self

Changes the maximum decoded footprint this decoder accepts per row.

See DEFAULT_MAX_ROW_BYTES for why a blob limit alone is not enough.

Source

pub fn next_row(&mut self) -> Result<Option<(usize, Value)>, CodecError>

Decodes the next table-indexed row, or None at a clean end of stream.

An end of stream after any part of a row is CodecError::Truncated, never a successful short read.

Source

pub fn skip_row(&mut self) -> Result<Option<usize>, CodecError>

Advances past the next row without building it, returning its table index, or None at a clean end of stream.

Framing, schema and limit checks are the ones Self::next_row applies, so a stream this accepts is exactly a stream that decodes. What it does not do is allocate: no Vec per blob, no Box per variant, no Value tree to throw away. That is the difference between asking whether a stream is a whole number of rows and decoding it to find out — the first question is the one a caller validating a table write is asking.

Source

pub fn into_inner(self) -> R

Returns the wrapped input reader.

Trait Implementations§

Source§

impl<R: Debug> Debug for Decoder<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Decoder<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Decoder<R>
where R: RefUnwindSafe,

§

impl<R> Send for Decoder<R>
where R: Send,

§

impl<R> Sync for Decoder<R>
where R: Sync,

§

impl<R> Unpin for Decoder<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for Decoder<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for Decoder<R>
where R: UnwindSafe,

Blanket Implementations§

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
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.

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.