Skip to main content

JxlBitstreamInput

Trait JxlBitstreamInput 

Source
pub trait JxlBitstreamInput {
    // Required methods
    fn available_bytes(&mut self) -> Result<usize, Error>;
    fn read(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>;

    // Provided methods
    fn skip(&mut self, bytes: usize) -> Result<usize, Error> { ... }
    fn unconsume(&mut self, _count: usize) -> Result<(), Error> { ... }
}

Required Methods§

Source

fn available_bytes(&mut self) -> Result<usize, Error>

Returns an estimate bound of the total number of bytes that can be read via read. Returning a too-low estimate here can impede parallelism. Returning a too-high estimate can increase memory usage.

Source

fn read(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Fills in bufs with more bytes, returning the number of bytes written. Buffers are filled in order and to completion.

Provided Methods§

Source

fn skip(&mut self, bytes: usize) -> Result<usize, Error>

Skips up to bytes bytes of input. The provided implementation just uses read, but in some cases this can be implemented faster. Returns the number of bytes that were skipped. If this returns 0, it is assumed that no more input is available.

Source

fn unconsume(&mut self, _count: usize) -> Result<(), Error>

Un-consumes read bytes. This will only be called at the end of a file stream, to un-read potentially over-read bytes. If ensuring that data is not read past the file end is not required, this method can safely be implemented as a no-op. The provided implementation does nothing.

Implementations on Foreign Types§

Source§

impl JxlBitstreamInput for &[u8]

Source§

fn available_bytes(&mut self) -> Result<usize, Error>

Source§

fn read(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Source§

fn skip(&mut self, bytes: usize) -> Result<usize, Error>

Source§

impl<R: Read + Seek> JxlBitstreamInput for BufReader<R>

Source§

fn available_bytes(&mut self) -> Result<usize, Error>

Source§

fn read(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Source§

fn skip(&mut self, bytes: usize) -> Result<usize, Error>

Source§

fn unconsume(&mut self, count: usize) -> Result<(), Error>

Implementors§