Skip to content

v0.4.0 -- Error unification, safety hardening, and edition 2024

Choose a tag to compare

@hamidr hamidr released this 11 Apr 08:43
· 101 commits to main since this release

Breaking changes

  • Unified error types: removed PipeErr type alias. The Operator trait now returns Result<B, PipeError> instead of Result<B, Box<dyn Error>>. PipeResult<T> is now Result<T, PipeError>. The #[operator] macro auto-converts Box<dyn Error> at the boundary, so most user code compiles unchanged.
  • broadcast_through() no longer takes an n parameter. The branch count is derived from transforms.len().
  • from_pull_once() and generate_once() return PipeError on double materialization instead of panicking.
  • Rust edition bumped to 2024. Minimum supported Rust version is now 1.85.

New features

  • #[pipe_fn] macro now documented and exported in prelude.
  • from_stream_buffered() and into_stream_buffered() for tunable stream interop channel sizes.
  • lines_with_max_len() to guard against OOM from long lines (default limit: 1 MiB).
  • Pipe::from_reader_sized() for custom AsyncRead buffer sizes.
  • Signal::modify() for in-place mutation with subscriber notification.
  • Emitter::emit_all() for batch element emission.
  • Expanded Sink constructors: new, collect, count, first, last, drain.
  • TcpConnection::into_bytes() and into_split() documented.
  • file::read_sized() documented.

Safety and security fixes

  • PullLines: max line length limit prevents OOM from newline-free input (P0 fix).
  • Integer overflow fixes in intersperse and PullChunks capacity calculations (saturating_mul, div_ceil).
  • par_eval_map_unordered: worker tasks now tracked via JoinSet and aborted on early exit, preventing leaked tasks.
  • chunks(0) and sliding_window(0) clamp to 1 instead of panicking.
  • Security documentation added for distinct() memory growth, group_adjacent_by() unbounded groups, path traversal in file I/O, lossy UTF-8 in lines(), and TCP timeout strategy.

Internal improvements

  • Extracted drain_to_channel() helper, deduplicating 5 inner-pipe drain loops across concurrency and operator modules.
  • Optimized intersperse buffer pre-allocation per chunk.
  • Fixed stale "knot-pipe" references in lib.rs doc comments.
  • Added pipe_fn to prelude exports.
  • Cargo.toml: added keywords, categories, readme, exclude patterns across all three crates. pipe-macros now has description, license, and repository fields.

Testing

  • 8 property-based tests via proptest: partition roundtrip, chunks/unchunks identity, distinct idempotency, map length preservation, take+skip partition, fold sum, filter, enumerate.
  • Unit tests for debounce, eval_for_each, empty pipe through 13 operators, error propagation through 5 operator types.
  • pipe-io error case tests: directory reads, empty files, mixed line endings, custom buffer sizes, raw TCP bytes, mid-stream disconnect, max line length enforcement.
  • Total: 220 tests, zero warnings.