pub struct RootJsonReader<R: Read> { /* private fields */ }Expand description
Streaming reader exposing only the root JSON slab of a JSLB byte stream.
This can be used by consumers which are only interested in the JSON at the root of the JSLB file and not in anything else.
Useful for compressed JSLB files (e.g. .jslb.gz) because you’ll only end up compressing the start of the file, provided the root JSON slab is the first slab.
Implementations§
Source§impl<R: Read> RootJsonReader<R>
impl<R: Read> RootJsonReader<R>
Sourcepub fn new(inner: R) -> Result<Self>
pub fn new(inner: R) -> Result<Self>
Wrap inner, reading the fixed header and slab table so that
subsequent reads yield exactly the root JSON slab’s bytes.
Fails with io::ErrorKind::InvalidData if the header or slab
table is malformed, if the designated root slab is not
SlabType::Json, or if the root slab’s byte range overlaps the
slab table. Fails with io::ErrorKind::UnexpectedEof if the
stream ends before the root slab’s start offset.
Trait Implementations§
Source§impl<R: Read> Read for RootJsonReader<R>
impl<R: Read> Read for RootJsonReader<R>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_, u8>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_, u8>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(
&mut self,
cursor: BorrowedCursor<'_, u8>,
) -> Result<(), Error>
fn read_buf_exact( &mut self, cursor: BorrowedCursor<'_, u8>, ) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read. Read more1.0.0 · Source§fn chain<R>(self, next: R) -> Chain<Self, R> ⓘ
fn chain<R>(self, next: R) -> Chain<Self, R> ⓘ
1.0.0 · Source§fn take(self, limit: u64) -> Take<Self> ⓘwhere
Self: Sized,
fn take(self, limit: u64) -> Take<Self> ⓘwhere
Self: Sized,
limit bytes from it. Read moreSource§fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
read_array)