rust
everything written here about rust — the drain log-parsing algorithm, a hand-rolled query dsl, zero-copy mmap parsing, mcp servers, tantivy search, and wasm charts
rust is what i write tools in. not services — tools: the things that parse gigabytes, run once, and have to be right and fast at the same time.
what does this blog cover about rust?
algorithms implemented from papers, mostly, and the parts the paper leaves out. the drain algorithm for streaming log-template extraction. welford’s online variance, so a rolling z-score never has to store the samples. a query dsl built by hand — tokenizer, recursive-descent parser, tree-walking evaluator — and when not to reach for a parser generator. zero-copy parsing straight out of an mmap, and the single invalid byte that turns it back into a heap copy.
then the applied end: three mcp servers in one cargo workspace, embedded tantivy doing bilingual full-text search, duckdb and sqlite in the same binary, ols regression and the collinearity trap, and charts rendered on canvas2d from rust with no javascript library at all.
if there is a pattern, it is that rust is where i go when i want to know how the thing actually works, and the borrow checker keeps me honest about it.
- one schema crate, two analyzers: bilingual full-text search with embedded tantivy — embedding tantivy for a latin/greek/spanish corpus — a shared schema crate, language-specific analyzers, and the by-name tokenizer coupling that fails silently
- two databases, one binary: duckdb for reads, sqlite for state — a polyglot-persistence split for a small analytics service — columnar duckdb for events, row sqlite for state, and a non-blocking batch-insert buffer
- brute-forcing the pit window: when 'just try them all' is the right call — an exhaustive search over every pit lap and compound to pick a race strategy — why brute force beats a clever heuristic at this scale, and the r-squared-as-confidence wart
- a query language in ~1000 lines: lexer, parser, evaluator — hand-rolling a log filter dsl in rust — tokenizer, recursive-descent parser, tree-walking evaluator, and when not to reach for a parser generator
- clean and verified are different claims: a two-axis trust state machine in postgres — modelling 'may we publish this' and 'how faithful is this text' as two orthogonal postgres columns, with check constraints as a structural backstop
- cookieless analytics: how a rotating daily salt kills the consent banner — identify visitors with a rotating sha-256 hash instead of a cookie — and skip the consent banner by never holding personal data
- hand-rolling ols regression in rust, and the collinearity trap that ate my coefficients — multiple linear regression from scratch — normal equations, cramer's rule, and the identifiability bug a singular-matrix guard turned into an honest None
- rust + wasm canvas2d charts with zero javascript libraries — rendering charts in the browser straight from rust on canvas2d — and the static-mut wart edition 2024 caught
- welford's algorithm and why i never store the samples — computing a rolling z-score over gigabytes of logs in constant memory — online variance, and three detectors combined by max
- building three mcp servers in rust with rmcp — one cargo workspace, three mcp servers, and a shared toolkit — plus the one rule stdio protocols never forgive
- implementing the drain algorithm in rust — turning a 2017 research paper into a streaming log-template extractor, and being honest about what i cut
- i didn't leave go for rust. i split my stack. — the 'which language' question is the wrong question. go for services, rust for tools — and here's the exact line.
related
for services rather than tools, see go . the split is deliberate and explained here .