NXS — Rust
The reference compiler (.nxs → .nxb) and core library. Also provides a direct binary writer for generating .nxb without a source text round-trip.
Requirements
Rust 1.75+ (stable).
Build
Compile .nxs to .nxb
Write .nxb directly
For bulk generation — no source text round-trip:
use ;
let schema = new;
let mut w = with_capacity;
for r in &records
let bytes: = w.finish;
Tests
Benchmarks
Generate fixtures
All language benchmarks share a fixture directory. Generate before running cross-language benchmarks:
# writes records_1000000.{nxb,json,csv}
Source layout
| File | Purpose |
|---|---|
src/main.rs |
nxs binary — CLI entry point |
src/lexer.rs |
Tokenizes .nxs source (sigils, keys, braces, brackets) |
src/parser.rs |
Builds an AST of Field { key, value } nodes |
src/compiler.rs |
Two-pass compiler: key dictionary, then binary emission |
src/writer.rs |
NxsWriter / Schema / Slot — direct binary writer API |
src/decoder.rs |
Minimal decoder used by tests |
src/error.rs |
NxsError enum |
src/bench.rs |
bench binary |
src/gen_fixtures.rs |
gen_fixtures binary |
Query engine
use ;
let data = read?;
let reader = new?;
// Count matching records
let n = reader.where_pred.count;
// Iterate — early termination via short-circuit
for record in reader.where_pred
// First match
if let Some = reader.all.next
// Nested path
let city = record.get_str_path;
Predicates
| Function | Matches |
|---|---|
eq(key, value) |
equality — bool, &str, i64, f64 |
gt(key, v) / lt(key, v) |
numeric comparison |
And(p1, p2) |
both pass |
Or(p1, p2) |
either passes |
Not(p) |
does not pass |
Zero-allocation hot path — predicate evaluation reads directly from &[u8] buffer.
For the format specification see SPEC.md. For cross-language examples see GETTING_STARTED.md.