Skip to main content

Module utils

Module utils 

Source
Expand description

Helper routines for safely reading integers from byte slices.

Many parts of the crate need to interpret raw data at specific offsets. The functions provided here centralize that logic, performing bounds checks and converting little‑endian byte sequences into native Rust integers. Errors are reported using FileParseError, allowing callers to bubble failures up without panicking.

Functions§

extract_u16
Reads a little-endian u16 at offset, returning FileParseError::BufferOverflow on truncation.
extract_u32
Reads a little-endian u32 at offset, returning FileParseError::BufferOverflow on truncation.
extract_u64
Reads a little-endian u64 at offset, returning FileParseError::BufferOverflow on truncation.