MessageReader

Struct MessageReader 

Source
struct MessageReader<R> {
    reader: R,
    buf: Vec<u8>,
}
Expand description

A low-level construct that reads Message::Messages from a reader while re-using a buffer for metadata. This is composed into StreamReader.

Fields§

§reader: R§buf: Vec<u8>

Implementations§

Source§

impl<R: Read> MessageReader<R>

Source

fn new(reader: R) -> Self

Source

fn maybe_next( &mut self, ) -> Result<Option<(Message<'_>, MutableBuffer)>, ArrowError>

Reads the entire next message from the underlying reader which includes the metadata length, the metadata, and the body.

§Returns
  • Ok(None) if the the reader signals the end of stream with EOF on the first read
  • Err(_) if the reader returns an error other than on the first read, or if the metadata length is invalid
  • Ok(Some(_)) with the Message and buffer containiner the body bytes otherwise.
Source

fn inner_mut(&mut self) -> &mut R

Get a mutable reference to the underlying reader.

Source

fn inner(&self) -> &R

Get an immutable reference to the underlying reader.

Source

pub fn read_meta_len(&mut self) -> Result<Option<usize>, ArrowError>

Read the metadata length for the next message from the underlying stream.

§Returns
  • Ok(None) if the the reader signals the end of stream with EOF on the first read
  • Err(_) if the reader returns an error other than on the first read, or if the metadata length is less than 0.
  • Ok(Some(_)) with the length otherwise.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<R> UnwindSafe for MessageReader<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.
§

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