Struct jxl_bitstream::Bitstream
source · pub struct Bitstream<'buf> { /* private fields */ }
Expand description
Bitstream reader with borrowed in-memory buffer.
Implementation is mostly from jxl-rs.
Implementations§
source§impl Bitstream<'_>
impl Bitstream<'_>
sourcepub fn peek_bits(&mut self, n: usize) -> u32
pub fn peek_bits(&mut self, n: usize) -> u32
Peeks bits from bitstream, without consuming them.
This method refills the bit buffer.
sourcepub fn peek_bits_const<const N: usize>(&mut self) -> u32
pub fn peek_bits_const<const N: usize>(&mut self) -> u32
Peeks bits from bitstream, without consuming them.
This method refills the bit buffer.
sourcepub fn peek_bits_prefilled(&mut self, n: usize) -> u32
pub fn peek_bits_prefilled(&mut self, n: usize) -> u32
Peeks bits from already filled bitstream, without consuming them.
This method does not refill the bit buffer.
sourcepub fn peek_bits_prefilled_const<const N: usize>(&mut self) -> u32
pub fn peek_bits_prefilled_const<const N: usize>(&mut self) -> u32
Peeks bits from already filled bitstream, without consuming them.
This method does not refill the bit buffer.
sourcepub fn consume_bits(&mut self, n: usize) -> Result<()>
pub fn consume_bits(&mut self, n: usize) -> Result<()>
Consumes bits in bit buffer.
§Errors
This method returns Err(Io(std::io::ErrorKind::UnexpectedEof))
when there are not enough
bits in the bit buffer.
sourcepub fn consume_bits_const<const N: usize>(&mut self) -> Result<()>
pub fn consume_bits_const<const N: usize>(&mut self) -> Result<()>
Consumes bits in bit buffer.
§Errors
This method returns Err(Io(std::io::ErrorKind::UnexpectedEof))
when there are not enough
bits in the bit buffer.
pub fn skip_bits(&mut self, n: usize) -> Result<()>
sourcepub fn zero_pad_to_byte(&mut self) -> Result<()>
pub fn zero_pad_to_byte(&mut self) -> Result<()>
Performs ZeroPadToByte
as defined in the JPEG XL specification.
source§impl Bitstream<'_>
impl Bitstream<'_>
sourcepub fn read_u64(&mut self) -> Result<u64>
pub fn read_u64(&mut self) -> Result<u64>
Reads an U64
as defined in the JPEG XL specification.
sourcepub fn read_bool(&mut self) -> Result<bool>
pub fn read_bool(&mut self) -> Result<bool>
Reads a Bool
as defined in the JPEG XL specification.
sourcepub fn read_f16_as_f32(&mut self) -> Result<f32>
pub fn read_f16_as_f32(&mut self) -> Result<f32>
Reads an F16
as defined in the JPEG XL specification, and convert it to f32
.
§Errors
Returns Error::InvalidFloat
if the value is NaN
or Infinity
.
pub fn read_bundle<B: Bundle<()>>(&mut self) -> Result<B, B::Error>
pub fn read_bundle_with_ctx<B: Bundle<Ctx>, Ctx>( &mut self, ctx: Ctx, ) -> Result<B, B::Error>
Trait Implementations§
Auto Trait Implementations§
impl<'buf> Freeze for Bitstream<'buf>
impl<'buf> RefUnwindSafe for Bitstream<'buf>
impl<'buf> Send for Bitstream<'buf>
impl<'buf> Sync for Bitstream<'buf>
impl<'buf> Unpin for Bitstream<'buf>
impl<'buf> UnwindSafe for Bitstream<'buf>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)