Skip to main content

DtactChildStdin

Struct DtactChildStdin 

Source
pub struct DtactChildStdin(/* private fields */);
Expand description

One end of a child process’s stdin pipe.

Exclusively owned by whoever holds it (returned by take_stdin on DtactChild) — each async op temporarily moves the handle into a pool closure and gets it back in the result, never shared behind a lock.

Implementations§

Source§

impl DtactChildStdin

Source

pub async fn write(&mut self, buf: Vec<u8>) -> Result<(usize, Vec<u8>)>

Write buf to the child’s stdin on the process pool, returning the number of bytes written and the buffer back for reuse.

§Errors

Returns whatever the underlying blocking Write::write on the pipe returns (e.g. BrokenPipe if the child has already exited and closed its end).

§Panics

Panics if called again while a previous call on the same &mut self hasn’t finished — in practice this is unreachable through safe code: taking &mut self for the duration of the returned future’s lifetime means a second call cannot start until the first’s future has been driven to completion (or dropped), at which point the handle has already been restored to Some.

Source

pub fn close(self)

Explicitly drop this end (closes the pipe), letting the child observe EOF on its stdin.

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, 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.