Expand description
Offset-based binary format for zero-copy memory mapping
This module re-exports the binary format structures from matchy-paraglob.
The canonical definitions live in matchy-paraglob::offset_format to ensure
a single source of truth for all #[repr(C)] binary format structures.
§What This Module Provides
ParaglobHeader- Main header (112 bytes, v5)PatternDataMapping- Pattern-to-data offset mappingGlobSegmentIndex,GlobSegmentHeader,CharClassItemEncoded- Glob segment structuresMAGIC,MATCHY_FORMAT_VERSION*- Format constants- Helper functions for reading structures from byte buffers
§Why Re-exports?
Binary format structures are defined once in matchy-paraglob and re-exported
here to avoid duplication. This prevents drift between identical #[repr(C)]
structs that must remain byte-for-byte compatible.
Structs§
- Char
Class Item Encoded - Encoded character class item (12 bytes, 4-byte aligned)
- Glob
Segment Header - Glob segment header (12 bytes, 4-byte aligned)
- Glob
Segment Index - Glob segment index entry (8 bytes, 4-byte aligned)
- Paraglob
Header - Main header for serialized Paraglob database (112 bytes, 4-byte aligned)
- Pattern
Data Mapping - Pattern-to-data mapping entry (12 bytes, 4-byte aligned)
Constants§
- MAGIC
- Magic bytes identifying Paraglob binary format
- MATCHY_
FORMAT_ VERSION - Current format version (v5: serialized glob segments for zero-copy loading)
- MATCHY_
FORMAT_ VERSION_ V1 - Previous format version (v1: patterns only, no data)
- MATCHY_
FORMAT_ VERSION_ V2 - Previous format version (v2: adds data section support)
- MATCHY_
FORMAT_ VERSION_ V3 - Previous format version (v3: adds AC literal mapping for zero-copy loading)
- MATCHY_
FORMAT_ VERSION_ V4 - Previous format version (v4: uses ACNodeHot for 50% memory reduction)
Functions§
- read_
cstring - Helper to read a null-terminated UTF-8 string from buffer
- read_
cstring_ ⚠with_ len - Helper to read a UTF-8 string from buffer with known length (FAST PATH)
- read_
str_ ⚠checked - Helper to read a UTF-8 string from buffer with known length (SAFE PATH - validates UTF-8)
- read_
str_ ⚠unchecked - Helper to read a UTF-8 string from buffer with known length (ULTRA-FAST PATH - NO UTF-8 VALIDATION)
- read_
struct ⚠ - Helper to safely read a struct from a byte buffer at an offset
- read_
struct_ ⚠slice - Helper to safely read a slice of structs from a byte buffer