Skip to main content

BitsReader

Trait BitsReader 

Source
pub trait BitsReader {
Show 21 methods // Required methods fn refill(&mut self); fn read_bits(&mut self, amount: u32) -> u32; fn read_bits_unchecked(&mut self, amount: u32) -> u32; fn read_bytes(&mut self, amount: u32) -> Vec<u8> ; fn read_bool(&mut self) -> bool; fn read_f32(&mut self) -> f32; fn read_var_u32(&mut self) -> u32; fn read_var_u64(&mut self) -> u64; fn read_var_i32(&mut self) -> i32; fn read_ubit_var(&mut self) -> u32; fn read_ubit_var_fp(&mut self) -> i32; fn read_ubit_var_fp_unchecked(&mut self) -> i32; fn read_normal(&mut self) -> f32; fn read_normal_vec3(&mut self) -> [f32; 3]; fn read_u64_le(&mut self) -> u64; fn read_cstring(&mut self) -> String; fn read_coordinate(&mut self) -> f32; fn read_angle(&mut self, n: u32) -> f32; fn read_bits_as_bytes(&mut self, n: u32) -> Vec<u8> ; fn remaining_bytes(&self) -> usize; fn seek(&mut self, offset: usize);
}

Required Methods§

Source

fn refill(&mut self)

Refills the internal lookahead buffer. Must be called before read_bits_unchecked to ensure sufficient bits are available in the lookahead buffer.

Source

fn read_bits(&mut self, amount: u32) -> u32

Source

fn read_bits_unchecked(&mut self, amount: u32) -> u32

Reads bits without refilling the buffer (unchecked).

The caller must ensure refill() was called and sufficient bits remain.

§Arguments
  • amount - Number of bits to read (must be ≤ 32)
Source

fn read_bytes(&mut self, amount: u32) -> Vec<u8>

Source

fn read_bool(&mut self) -> bool

Source

fn read_f32(&mut self) -> f32

Source

fn read_var_u32(&mut self) -> u32

Source

fn read_var_u64(&mut self) -> u64

Source

fn read_var_i32(&mut self) -> i32

Source

fn read_ubit_var(&mut self) -> u32

Source

fn read_ubit_var_fp(&mut self) -> i32

Source

fn read_ubit_var_fp_unchecked(&mut self) -> i32

Reads a variable-length unsigned integer (field path encoding) without refilling.

The caller must ensure sufficient bits are available in the lookahead buffer.

Source

fn read_normal(&mut self) -> f32

Source

fn read_normal_vec3(&mut self) -> [f32; 3]

Reads a compressed 3D normal vector.

The vector components are encoded with selective precision, and the third component is derived from the unit length constraint.

Source

fn read_u64_le(&mut self) -> u64

Reads a little-endian 64-bit unsigned integer.

Source

fn read_cstring(&mut self) -> String

Reads a null-terminated C-style string.

Source

fn read_coordinate(&mut self) -> f32

Source

fn read_angle(&mut self, n: u32) -> f32

Source

fn read_bits_as_bytes(&mut self, n: u32) -> Vec<u8>

Source

fn remaining_bytes(&self) -> usize

Returns the number of bytes remaining in the buffer.

Source

fn seek(&mut self, offset: usize)

Seeks to a specific byte offset from the start.

§Arguments
  • offset - Byte offset from the start of the data

Implementors§