Expand description
Little-endian field reads and writes over a byte buffer.
Buffer ownership is bytes::Bytes — refcounted, cheaply sliced, which
is what lets a BAM record borrow its decompressed BGZF block and a bbi item
its decompressed data block without a copy. What is left is the typed-field
half, and that is this file.
Every format here is little-endian and its readers refuse a byte-swapped
file rather than swapping it, so there is no big-endian path. Reads copy
rather than transmute: a record offset in a binary format is under no
obligation to be aligned, and from_le_bytes over a copied array is both
correct and, at these widths, free.
Bounds checking is not optional. Every read is checked and returns
Error::Corrupt naming the offset, which is the same check the language
emits anyway.