Skip to main content

Input

Enum Input 

Source
pub enum Input {
    Ignored,
    AsyncRead(Box<dyn AsyncRead + Send + Sync + Unpin>),
    Jsonl(JsonlStream),
}
Expand description

The source of bytes to supply to a child’s stdin.

Program wrappers configure the child’s stdin from this value and feed the resulting pipe during execution. Graph-output runners transfer ownership of their input into the returned stream. Buffered runners consume it in place. Repeated executions never replay bytes that have already been read. Early exit or cancellation can leave input partially consumed, including a partly written record; reusing it does not guarantee record-boundary resumption.

With std enabled, conversion to Stdio only selects null or piped stdin; it does not transfer bytes. The consuming conversion also drops any stored reader or batch stream. Use Input::as_stdio to preserve the source for execution.

Variants§

§

Ignored

Supplies no bytes by configuring stdin to read from the null device.

§

AsyncRead(Box<dyn AsyncRead + Send + Sync + Unpin>)

Supplies bytes from an owned asynchronous reader through a stdin pipe.

The reader must support use across asynchronous tasks (Send + Sync) and unpinned I/O (Unpin). Its contents are omitted from debug output.

§

Jsonl(JsonlStream)

Available on crate feature std only.

Supplies JSONL batches, applying backpressure and propagating source errors. Contiguous terminated batches are written directly; fragmented batches use bounded vectored I/O when supported, or a reusable copy buffer. Batch boundaries are not encoded on the wire. Empty batches are ignored. Existing line endings are preserved; an LF is appended to any line that does not end in LF so adjacent records cannot run together. An empty line therefore writes a blank line. Line constructors enforce framing; UTF-8, JSON, and RDF mapping profiles are not validated here.

Implementations§

Source§

impl Input

Source

pub fn as_stdio(&self) -> Stdio

Available on crate feature std only.

Selects the child’s stdin configuration without consuming this input.

Returns null stdin for Ignored and a pipe for AsyncRead and Jsonl. The caller must still feed the child’s pipe after spawning it.

Source

pub fn into_jsonl(self) -> Self

Available on crate feature std only.

Adapts byte input to batched JSONL input using default thresholds.

Wraps AsyncRead using crate::jsonl_batches; other variants are returned unchanged. Adaptation is lazy and performs no I/O. When fed to a child, a final unterminated line gains an LF as described by Jsonl.

Source

pub fn into_jsonl_with_batching(self, options: BatchOptions) -> Self

Available on crate feature std only.

Adapts an asynchronous reader into JSONL batches with the supplied policy. Existing batch streams and ignored input are returned unchanged. To rebatch a stream, combine crate::flatten_batches and crate::batch_lines.

Trait Implementations§

Source§

impl Debug for Input

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Into<Stdio> for Input

Available on crate feature std only.
Source§

fn into(self) -> Stdio

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Input

§

impl !Sync for Input

§

impl !UnwindSafe for Input

§

impl Freeze for Input

§

impl Send for Input

§

impl Unpin for Input

§

impl UnsafeUnpin for Input

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