Struct Stdio

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

A WslLaunch stdin, stdout, or stderr parameter

Implementations§

Source§

impl Stdio

Source

pub fn null() -> Self

This stream will be ignored. This is the equivalent of attaching the stream to /dev/null

Source

pub fn from_bytes(bytes: impl AsRef<[u8]>) -> Result<Self>

Stream data from a temporary file containing the contents of bytes

Source

pub fn from_file(file: File) -> Result<Self>

Stream data from or into a file handle

Source

pub unsafe fn from_handle(handle: HANDLE) -> Self

Take ownership of a raw handle

§Safety

handle is assumed to be “valid”. That is:

Source

pub unsafe fn from_as_raw_handle(owner: impl AsRawHandle + 'static) -> Self

Take ownership of something with a raw handle

§Safety

owner.as_raw_handle() is assumed to be “valid”. That is:

  • WslLaunch(…, owner.as_raw_handle(), …) must be legal for stdIn, stdOut, or stdErr
  • The handle must be inheritable without CreateProcess’s bInheritHandles=TRUE
Source

pub fn as_raw_handle(&self) -> RawHandle

Get a standard std::os::windows::{io::RawHandle / raw::HANDLE}

Source

pub fn as_winapi_handle(&self) -> HANDLE

Get a winapi::shared::ntdef::HANDLE

Trait Implementations§

Source§

impl AsRawHandle for Stdio

Source§

fn as_raw_handle(&self) -> RawHandle

Extracts the raw handle. Read more
Source§

impl From<()> for Stdio

Source§

fn from(_value: ()) -> Self

Converts to this type from the input type.
Source§

impl TryFrom<&[u8]> for Stdio

Source§

type Error = Error

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

fn try_from(value: &[u8]) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<&str> for Stdio

Source§

type Error = Error

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

fn try_from(value: &str) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<File> for Stdio

Source§

type Error = Error

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

fn try_from(value: File) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<String> for Stdio

Source§

type Error = Error

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

fn try_from(value: String) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Vec<u8>> for Stdio

Source§

type Error = Error

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

fn try_from(value: Vec<u8>) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Stdio

§

impl !RefUnwindSafe for Stdio

§

impl !Send for Stdio

§

impl !Sync for Stdio

§

impl Unpin for Stdio

§

impl !UnwindSafe for Stdio

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.