Expand description
Parser for DX Machine format
Implements all DX features:
- Schema-guided vacuum parsing
- Alias system ($)
- Prefix inheritance (^)
- Vertical ditto (_)
- Type hints (%i, %s, %f, %b, %x, %#)
- Anchor references (@)
- DX ∞: Base62 integers (%x), Auto-increment (%#)
§Thread Safety
The Parser struct is not thread-safe (Send but not Sync) because it
maintains mutable parsing state. However, the module-level parse() function
is completely stateless and can be called concurrently from multiple threads:
use std::thread;
use serializer::parse;
// Safe: each thread creates its own Parser internally
let handles: Vec<_> = (0..4).map(|i| {
thread::spawn(move || {
let input = format!("key{}:value{}", i, i);
parse(input.as_bytes())
})
}).collect();
for handle in handles {
assert!(handle.join().unwrap().is_ok());
}For parallel parsing, create a separate Parser instance per thread rather
than sharing one instance.
Structs§
- Parser
- Parser state
Functions§
- parse
- Parse DX bytes into a value
- parse_
str - Parse DX from string
- parse_
stream - Stream parser for large files