Skip to main content

PipeInner

Struct PipeInner 

Source
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

Source

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.

Source

pub fn writer_handle(self: &Arc<Self>) -> SharedOutput

One attached writer half over this backend. Dropping the handle detaches, preserving EOF-from-detach semantics.

Source

pub fn writer_count(&self) -> usize

Live data-writer attachments (excludes keeper pins). Used for INSPECT() diagnostics; never blocks.

Source

pub fn buffered_bytes(&self) -> u64

Bytes currently buffered for readers. Used for diagnostics.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more