Workspace layout
Honzo/
Cargo.toml # Rust workspace root
Build/
crates/
honzo-core/ # no_std wire-format + parser
honzo-chunks/ # Chunk semantics (SIDX, COVT, extras)
honzo-io/ # Builder/reader/stream + compression (std)
honzo-convert/ # epub/mobi/pdf import
honzo-c/ # C FFI bindings (Diplomat)
honzo-wasm/ # WASM target
honzo-cli/ # CLI binary
adapters/
typescript/ # npm @nisoku/honzo
Demo/ # Vite web demo
Docs/ # Documentation site (docmd)
Tests/
fixtures/ # Sample .hzo files
corpus/ # Edge case files
tests/ # Rust integration tests
honzo.ksy # Kaitai Struct spec
Crate dependency graph
Crate responsibilities
honzo-core
The bottom layer. Defines the Honzo wire format as Rust structs and provides zero-copy parsing. No allocation, no compression, no I/O.
parse.rs–HonzoParserthat casts byte slices into HEAD/TOC/EXTRA structstypes.rs–HonzoHead,TocEntry,ExtraEntry,HonzoErrortypes#![no_std]– Can be used in embedded and kernel contexts
honzo-chunks
Chunk type semantics on top of the wire format. Validates and interprets chunk data.
data/chap.rs– Chapter content validationdata/img.rs– Image validation and MIME detectiondata/css.rs– CSS parsing validation (via cssparser)data/font.rs– Font magic-byte detection and embedding metadatadata/covr.rs– Cover image helpersdata/sidx.rs– Search index encoding/decodingdata/math.rs– Math equation handlingextra/anno.rs– Annotation typesextra/drm.rs– DRM envelope typesextra/sync.rs– Sync track types
honzo-io
I/O layer with streaming, building, compression, and DRM.
reader.rs–HonzoReaderwith optional DRM decryptionstream.rs–HonzoStreamfor pull-based chapter readingwriter.rs–Builderfor programmatic file constructioncrypto.rs– AES-256-GCM encryption, ECDH key exchange, HKDF key derivationcompress.rs– LZ4 compression/decompression
honzo-convert
Converts existing ebook formats to Honzo.
epub.rs– EPUB 2/3 conversion (zip extraction, OPF/NCX parsing)mobi.rs– MOBI conversionpdf.rs– PDF text extraction via pdf_oxidepagebreaks.rs– EPUB page break detection and heuristic estimation
honzo-c
C FFI via Diplomat. Exposes a subset of honzo-core and honzo-io as a C API.
honzo-wasm
WASM target via wasm-pack. Wraps honzo-core and honzo-io for browser and Node.js.
honzo-cli
CLI binary with commands: make, info, inspect, convert, validate.
Data flow
Reading
Or with streaming:
Writing
Security boundaries
The no_unsafe directive is enforced in honzo-chunks with #![forbid(unsafe_code)]. Unsafe code is used only in honzo-c for the C FFI boundary and in honzo-core HonzoParser for pointer casts. All chunk data is validated before exposure. Encryption uses AES-256-GCM with random nonces and ECDH key exchange.