pub struct PipeInner { /* private fields */ }Expand description
Shared script-pipe backend: buffer plus writer/keeper accounting.
Clone the Arc, never the state: every handle aliases one channel.
Implementations§
Source§impl PipeInner
impl PipeInner
Sourcepub fn reader_handle(self: &Arc<Self>) -> SharedInput
pub fn reader_handle(self: &Arc<Self>) -> SharedInput
One shared reader half over this backend. Each call mints a fresh
PipeReader over the same buffer, so readers share bytes (not
positions) exactly like the registry-era shared input.
Sourcepub fn writer_handle(self: &Arc<Self>) -> SharedOutput
pub fn writer_handle(self: &Arc<Self>) -> SharedOutput
One attached writer half over this backend. Dropping the handle detaches, preserving EOF-from-detach semantics.
Sourcepub fn writer_count(&self) -> usize
pub fn writer_count(&self) -> usize
Live data-writer attachments (excludes keeper pins). Used for
INSPECT() diagnostics; never blocks.
Sourcepub fn buffered_bytes(&self) -> u64
pub fn buffered_bytes(&self) -> u64
Bytes currently buffered for readers. Used for diagnostics.
Sourcepub fn peek_bytes(&self) -> Result<Vec<u8>>
pub fn peek_bytes(&self) -> Result<Vec<u8>>
Non-destructive snapshot of buffered bytes for pipe-content assertions. Never waits: returns what is buffered right now.
Sourcepub fn force_close(&self)
pub fn force_close(&self)
Explicitly close the pipe: readers drain buffered bytes, then observe
EOF regardless of live writers or keeper pins. General primitive
(sockets have shutdown, files have close); pipes previously had
detach-only EOF. A later writer attachment resurrects the pipe per
standard attach semantics, so callers must not reuse closed pipes
for new sessions.
Sourcepub fn pin_keeper(&self)
pub fn pin_keeper(&self)
Pin a keeper slot so transient writer churn can never observe zero
writers. Called synchronously on the spawning thread before an
ASYNC worker starts; the returned guard unpins on drop when the
worker exits, restoring normal EOF semantics afterwards.
Never touches closed: pinning a pipe that already reached EOF
must not resurrect it into a blocking pipe.
Sourcepub fn unpin_keeper(&self)
pub fn unpin_keeper(&self)
Release one keeper slot. When the last transient writer and the last keeper are both gone the pipe closes and blocked readers see EOF.
Sourcepub fn read_into_timeout(
&self,
buf: &mut [u8],
backstop: Duration,
) -> Result<Option<usize>>
pub fn read_into_timeout( &self, buf: &mut [u8], backstop: Duration, ) -> Result<Option<usize>>
Timeout-bounded variant of the blocking buffer read for bridge
worker loops: returns Ok(None) when the backstop elapses with no
data and no close, so cancellation resolves on a tick instead of
hanging on a condvar. Bridge-only caller; every DSL reader keeps
the blocking read with unchanged semantics.