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§
Sourcefn available_bytes(&mut self) -> Result<usize, Error>
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.
Provided Methods§
Sourcefn skip(&mut self, bytes: usize) -> Result<usize, Error>
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.
Sourcefn unconsume(&mut self, _count: usize) -> Result<(), Error>
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.