Skip to main content

Module bytes

Module bytes 

Source
Expand description

Bounds-checked, zero-copy byte access.

Every container parser works on &[u8] slices of the (usually memory-mapped) input. All offset arithmetic is checked: a malformed offset yields Error::CorruptFile instead of a panic or out-of-bounds read.

Structs§

Cursor
A sequential cursor over a byte slice.

Enums§

ByteOrder
Byte order of multi-byte integers.

Traits§

ReadAt
Random-access endian-aware reads on a byte slice.

Functions§

ascii_field
Decode a fixed-length, NUL-padded ASCII field into a trimmed String.
find
Find the first occurrence of needle in hay (simple, used for marker scans in headers only).
slice_at
Return data[offset..offset+len] or a corruption error.
slice_at_lenient
Return data[offset..] clamped to at most len bytes. Used for payloads where vendors routinely declare slightly more bytes than the file contains (truncated final strips are a common real-world quirk).