From 59dd19aaaa3ec775f0b65e71c09f74ef9e51e5de Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Sat, 9 May 2026 10:22:44 -0700 Subject: [PATCH] 0.18 round 2: re-export Pipeline + Sink + Flow at the crate root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round 2 #1 landed `Pipeline` / `Sink` / `Flow` / `DEFAULT_PIPELINE_DEPTH` in `crate::io::pipeline` but only re-exported them through `crate::io` (which is `pub(crate)`), so no out-of-tree consumer could reach them. autorip's round 2 #2 (lifting the mux loop onto Pipeline + MuxSink) is the first such consumer; surface the primitives at the crate root for ergonomic access. No behaviour change — the items themselves are unchanged from round 2 #1; this is just `pub use` plumbing. Single contributor: MattJackson. --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 7875c47..d43dc95 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -126,6 +126,19 @@ pub use error::{Error, Result}; // component; poll `is_cancelled()` inside the loop body. pub use halt::Halt; +// Generic bounded producer/consumer primitive used by sweep, patch, and +// mux to overlap reads with writes via a dedicated consumer thread. +// `Pipeline::spawn(depth, sink)` spawns the consumer; `pipe.send(item)` +// pushes one item with back-pressure; `pipe.finish()` joins the +// consumer and surfaces its `close()` output. Callers implement `Sink` +// to define per-item behaviour and end-of-stream finalisation. +// +// `DEFAULT_PIPELINE_DEPTH` (=4) is the depth sweep + mux use; patch +// uses `WRITE_THROUGH_DEPTH` (=1) so each read fully drains before the +// next can enqueue. Returning `Flow::Stop` from `apply` ends the +// consumer cleanly (still calls `close()`). +pub use io::pipeline::{DEFAULT_PIPELINE_DEPTH, Flow, Pipeline, Sink, WRITE_THROUGH_DEPTH}; + // ─── Drive events (low-level callbacks) ───────────────────────────────────── pub use event::{Event, EventKind}; pub use identity::DriveId;