Skip to main content

PrivateChild

Struct PrivateChild 

Source
pub struct PrivateChild { /* private fields */ }
Expand description

A child started with a PrivateSecret on its stdin. Dropping it closes the pipe (the child’s cue to exit) and then the owned child is terminated by its own Drop.

Implementations§

Source§

impl PrivateChild

Source

pub fn spawn(command: OwnedCommand) -> Result<Self>

Start command with a fresh secret. Stdin is replaced with a pipe; the secret is written as the first line and the pipe stays open for the child’s lifetime. Put nothing secret in the arguments or environment.

Source

pub fn spawn_with(command: OwnedCommand, secret: PrivateSecret) -> Result<Self>

spawn with a secret the caller made.

Source

pub fn spawn_with_extra( command: OwnedCommand, secret: PrivateSecret, extra_line: Option<&str>, ) -> Result<Self>

spawn_with for a child whose handshake is more than the secret: the secret line, then extra_line (for example a path or a second key), both written before this returns. extra_line must not contain a newline; a line that does is refused with InvalidInput before the child starts.

Source

pub fn write_line(&mut self, line: &str) -> Result<()>

Write one more line to the child’s stdin after the handshake and flush it. Fails with BrokenPipe once the stdin is closed. line must not contain a newline.

Source

pub fn secret(&self) -> &PrivateSecret

The secret to give a ClientConfig.

Source

pub fn child(&self) -> &OwnedChild

The owned child, for waiting, termination and the rest of its lifecycle.

Source

pub fn child_mut(&mut self) -> &mut OwnedChild

Mutable access to the owned child.

Source

pub fn close_stdin(&mut self)

Close the child’s stdin: the polite request to exit. Idempotent.

Trait Implementations§

Source§

impl Debug for PrivateChild

Source§

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

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

impl Drop for PrivateChild

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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 = !

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.