#[non_exhaustive]pub enum StdinData {
Bytes(Vec<u8>),
Reader(Box<dyn Read + Send>),
}Expand description
Input data to feed to a child process’s stdin.
Construct via the From impls for bytes/strings, or
from_reader / from_async_reader
for streaming sources.
§Retry and clone semantics
Bytes: owned. If theCmdis configured to retry, each attempt re-feeds the same bytes (internally the buffer isArc-shared for cheap clones).Reader: one-shot. The first run attempt consumes the reader; subsequent retries or cloned-then-run attempts see no stdin. Avoid.retry()with a reader unless you understand this.AsyncReader: one-shot likeReader. Only usable on the async path (Cmd::run_async/Cmd::spawn_async). Passing it to the sync runner surfaces aRunError::SpawnwithErrorKind::InvalidInput.
§Picking the right variant for large inputs
For inputs larger than a few MB, the sync Reader variant streams
through an OS pipe without buffering the whole thing in memory. On the
async path, Reader would require spawn_blocking to drain the sync
reader fully into memory before writing — not suitable for
gigabyte-sized inputs. Use from_async_reader
with a tokio::fs::File or any other AsyncRead source for async
streaming.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Bytes(Vec<u8>)
Owned bytes. Reusable across retries.
Reader(Box<dyn Read + Send>)
One-shot sync reader. The reader only needs Send; it doesn’t have
to be Sync because procpilot hands it to at most one thread at a
time (via Arc<Mutex<Option<_>>>).
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StdinData
impl !RefUnwindSafe for StdinData
impl Send for StdinData
impl !Sync for StdinData
impl Unpin for StdinData
impl UnsafeUnpin for StdinData
impl !UnwindSafe for StdinData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more