argus/lib.rs
1//! **argus-chunk** — Argus watches over chunk IO.
2//!
3//! Little-endian wire primitives, bounds-checked spans, and raw/zstd codecs
4//! shared by Tetration and Tessera. Domain layouts (superblocks, index rows,
5//! catalogs) stay in those crates.
6//!
7//! # Scope
8//!
9//! Argus intentionally owns only format-neutral mechanics:
10//!
11//! - [`le`] reads and writes fixed-width little-endian fields and validates
12//! byte spans.
13//! - [`codec`] implements the shared payload codec tags (`0` raw, `1` zstd).
14//! - [`mmap`] owns a read-only memory map together with its file handle.
15//!
16//! File magic, layout versions, superblocks, index rows, catalogs, and semantic
17//! validation belong to the consuming format crate.
18//!
19//! # Wire example
20//!
21//! ```rust
22//! use argus::le::{LeReader, LeWriter, align8};
23//!
24//! assert_eq!(align8(9), 16);
25//!
26//! let mut buf = [0u8; 16];
27//! {
28//! let mut w = LeWriter::new(&mut buf);
29//! w.put_bytes(b"TESS");
30//! w.put_u32(0);
31//! w.put_u64(64);
32//! }
33//! let mut r = LeReader::new(&buf);
34//! assert_eq!(&r.take_4(), b"TESS");
35//! assert_eq!(r.take_u32(), 0);
36//! assert_eq!(r.take_u64(), 64);
37//! ```
38
39#![warn(missing_docs)]
40
41/// Raw and zstd chunk payload encoding.
42pub mod codec;
43/// Little-endian cursors, alignment, and byte-span validation.
44pub mod le;
45/// Read-only memory-mapped file ownership.
46pub mod mmap;
47
48pub use codec::{CodecError, PayloadCodec, decode, encode};
49pub use le::{
50 BufferTooShort, LeReader, LeWriter, SpanError, align8, checked_subslice, checked_u64_byte_span,
51 padding_to_align8,
52};
53pub use mmap::MappedFile;