argus-chunk 0.1.0

Argus watches over chunk IO — little-endian wire primitives, bounds-checked spans, and raw/zstd codecs
Documentation
//! **argus-chunk** — Argus watches over chunk IO.
//!
//! Little-endian wire primitives, bounds-checked spans, and raw/zstd codecs
//! shared by Tetration and Tessera. Domain layouts (superblocks, index rows,
//! catalogs) stay in those crates.
//!
//! # Scope
//!
//! Argus intentionally owns only format-neutral mechanics:
//!
//! - [`le`] reads and writes fixed-width little-endian fields and validates
//!   byte spans.
//! - [`codec`] implements the shared payload codec tags (`0` raw, `1` zstd).
//! - [`mmap`] owns a read-only memory map together with its file handle.
//!
//! File magic, layout versions, superblocks, index rows, catalogs, and semantic
//! validation belong to the consuming format crate.
//!
//! # Wire example
//!
//! ```rust
//! use argus::le::{LeReader, LeWriter, align8};
//!
//! assert_eq!(align8(9), 16);
//!
//! let mut buf = [0u8; 16];
//! {
//!     let mut w = LeWriter::new(&mut buf);
//!     w.put_bytes(b"TESS");
//!     w.put_u32(0);
//!     w.put_u64(64);
//! }
//! let mut r = LeReader::new(&buf);
//! assert_eq!(&r.take_4(), b"TESS");
//! assert_eq!(r.take_u32(), 0);
//! assert_eq!(r.take_u64(), 64);
//! ```

#![warn(missing_docs)]

/// Raw and zstd chunk payload encoding.
pub mod codec;
/// Little-endian cursors, alignment, and byte-span validation.
pub mod le;
/// Read-only memory-mapped file ownership.
pub mod mmap;

pub use codec::{CodecError, PayloadCodec, decode, encode};
pub use le::{
    BufferTooShort, LeReader, LeWriter, SpanError, align8, checked_subslice, checked_u64_byte_span,
    padding_to_align8,
};
pub use mmap::MappedFile;