Struct wasi_common::pipe::ReadPipe
source · [−]pub struct ReadPipe<R: Read> { /* private fields */ }
Expand description
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 = Table::new();
let mut ctx = WasiCtx::new(random, clocks, sched, table);
ctx.set_stdin(Box::new(stdin.clone()));
Implementations
sourceimpl<R: Read> ReadPipe<R>
impl<R: Read> ReadPipe<R>
sourcepub fn new(r: R) -> Self
pub fn new(r: R) -> Self
Create a new pipe from a Read
type.
All Handle
read operations delegate to reading from this underlying reader.
Create a new pipe from a shareable Read
type.
All Handle
read operations delegate to reading from this underlying reader.
sourcepub fn try_into_inner(self) -> Result<R, Self>
pub fn try_into_inner(self) -> Result<R, Self>
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
sourceimpl<R: Read + Any + Send + Sync> WasiFile for ReadPipe<R>
impl<R: Read + Any + Send + Sync> WasiFile for ReadPipe<R>
fn as_any(&self) -> &dyn Any
fn get_filetype<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<FileType, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn read_vectored<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
bufs: &'life1 mut [IoSliceMut<'a>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn pollable(&self) -> Option<BorrowedFd<'_>>
fn isatty(&mut self) -> bool
fn sock_accept<'life0, 'async_trait>(
&'life0 mut self,
_fdflags: FdFlags
) -> Pin<Box<dyn Future<Output = Result<Box<dyn WasiFile>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn sock_recv<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ri_data: &'life1 mut [IoSliceMut<'a>],
_ri_flags: RiFlags
) -> Pin<Box<dyn Future<Output = Result<(u64, RoFlags), Error>> + Send + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn sock_send<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
_si_data: &'life1 [IoSlice<'a>],
_si_flags: SiFlags
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn sock_shutdown<'life0, 'async_trait>(
&'life0 mut self,
_how: SdFlags
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn datasync<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn sync<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_fdflags<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<FdFlags, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn set_fdflags<'life0, 'async_trait>(
&'life0 mut self,
_flags: FdFlags
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_filestat<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Filestat, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn set_filestat_size<'life0, 'async_trait>(
&'life0 mut self,
_size: u64
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn advise<'life0, 'async_trait>(
&'life0 mut self,
_offset: u64,
_len: u64,
_advice: Advice
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn allocate<'life0, 'async_trait>(
&'life0 mut self,
_offset: u64,
_len: u64
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn set_times<'life0, 'async_trait>(
&'life0 mut self,
_atime: Option<SystemTimeSpec>,
_mtime: Option<SystemTimeSpec>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn read_vectored_at<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
_bufs: &'life1 mut [IoSliceMut<'a>],
_offset: u64
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn write_vectored<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
_bufs: &'life1 [IoSlice<'a>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn write_vectored_at<'a, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
_bufs: &'life1 [IoSlice<'a>],
_offset: u64
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn seek<'life0, 'async_trait>(
&'life0 mut self,
_pos: SeekFrom
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn peek<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_buf: &'life1 mut [u8]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn num_ready_bytes<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn readable<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn writable<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more