ripsed-core
Core edit engine for ripsed — a fast, modern stream editor.
This crate contains the pure logic (no I/O):
- Edit engine — find/replace, delete, insert, transform, surround,
indent/dedent, applied through whichever execution path fits: the
per-line loop, a whole-buffer splice fast path for eligible literal
replaces, multiline (cross-line) matching like ripgrep's
-U, or the incrementalLineProcessorfor streaming callers - Pattern matching — literal and regex matching with case-insensitive support and a whole-buffer prescreen that rejects non-matching files at substring-search speed
- Operation IR — the
Openum representing all supported operations, including replacement-count control (first_per_line,first_in_file,{"max": n}) - Ranges — numeric line ranges and sed-style pattern-addressed
regions (
/start/,/end/) - Script parser — parse
.ripscript files into operation sequences - Error taxonomy — structured errors with machine-readable codes and actionable hints
- Configuration —
.ripsed.tomlparsing and discovery - Undo — undo log data structures for reversible operations
A load-bearing invariant for agent consumers: Change metadata always
equals the bytes actually written, including line separators.
Usage
use engine;
use Matcher;
use Op;
let op = Replace ;
let matcher = new.unwrap;
let output = apply.unwrap;
assert_eq!;
For embedding with file I/O included (locking, atomic writes, undo), use
the ripsed facade crate instead.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.