Struct wasi_common::pipe::ReadPipe[][src]

pub struct ReadPipe<R: Read> { /* fields omitted */ }

A virtual pipe read end.

A variety of From impls are provided so that common pipe types are easy to create. For example:

use wasi_common::{pipe::ReadPipe, WasiCtx, Table};
let stdin = ReadPipe::from("hello from stdin!");
// Brint these instances from elsewhere (e.g. wasi-cap-std-sync):
let random = todo!();
let clocks = todo!();
let sched = todo!();
let table = Rc::new(RefCell::new(Table::new()));
let ctx = WasiCtx::builder(random, clocks, sched, table)
            .stdin(Box::new(stdin.clone()))
            .build();

Implementations

impl<R: Read> ReadPipe<R>[src]

pub fn new(r: R) -> Self[src]

Create a new pipe from a Read type.

All Handle read operations delegate to reading from this underlying reader.

pub fn from_shared(reader: Arc<RwLock<R>>) -> Self[src]

Create a new pipe from a shareable Read type.

All Handle read operations delegate to reading from this underlying reader.

pub fn try_into_inner(self) -> Result<R, Self>[src]

Try to convert this ReadPipe<R> back to the underlying R type.

This will fail with Err(self) if multiple references to the underlying R exist.

Trait Implementations

impl<R: Read> Clone for ReadPipe<R>[src]

impl<R: Debug + Read> Debug for ReadPipe<R>[src]

impl From<&'_ [u8]> for ReadPipe<Cursor<Vec<u8>>>[src]

impl From<&'_ str> for ReadPipe<Cursor<String>>[src]

impl From<String> for ReadPipe<Cursor<String>>[src]

impl From<Vec<u8, Global>> for ReadPipe<Cursor<Vec<u8>>>[src]

impl<R: Read + Any> WasiFile for ReadPipe<R>[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for ReadPipe<R>

impl<R> Send for ReadPipe<R> where
    R: Send + Sync

impl<R> Sync for ReadPipe<R> where
    R: Send + Sync

impl<R> Unpin for ReadPipe<R>

impl<R> UnwindSafe for ReadPipe<R>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointee for T[src]

type Pointer = u32

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,