struct MessageReader<R> {
reader: R,
buf: Vec<u8>,
}
Expand description
A low-level construct that reads Message::Message
s 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>
impl<R: Read> MessageReader<R>
fn new(reader: R) -> Self
Sourcefn maybe_next(
&mut self,
) -> Result<Option<(Message<'_>, MutableBuffer)>, ArrowError>
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 readErr(_)
if the reader returns an error other than on the first read, or if the metadata length is invalidOk(Some(_))
with the Message and buffer containiner the body bytes otherwise.
Sourcepub fn read_meta_len(&mut self) -> Result<Option<usize>, ArrowError>
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 readErr(_)
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> 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