subms-segment-reader-0.5.2 has been yanked.
Segment reader - Rust
Read length-prefix framed records from a segment file. Truncated tails surface as a typed error, not a crash.
Part of the submillisecond.com cookbook. Zero external dependencies; std only.
Install
[]
= "0.4"
Quickstart
Public API
pub enum Errorpub struct SegmentReader<R: Read>pub fn new(reader: R) -> Selfpub fn next_record(&mut self) -> Result<Option<&[u8]>, Error>pub struct SegmentWriter<W: Write>pub fn new(writer: W) -> Selfpub fn write(&mut self, record: &[u8]) -> io::Result<()>pub fn flush(&mut self) -> io::Result<()>
Files
src/lib.rs- implementation.tests/- integration tests; correctness, edge cases, property/stress.examples/demo.rs- stdout walkthrough.examples/perf_main.rs- bench entry (behind theharnessfeature).
License
Dual-licensed under MIT OR Apache-2.0.