Struct wasi_common::pipe::ReadPipe [−][src]
pub struct ReadPipe<R: Read> { /* fields omitted */ }
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 = Rc::new(RefCell::new(Table::new())); let mut ctx = WasiCtx::new(random, clocks, sched, table); ctx.set_stdin(Box::new(stdin.clone()));
Implementations
impl<R: Read> ReadPipe<R>
[src]
impl<R: Read> ReadPipe<R>
[src]pub fn new(r: R) -> Self
[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]
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]
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 + Any + Send + Sync> WasiFile for ReadPipe<R>
[src]
impl<R: Read + Any + Send + Sync> WasiFile for ReadPipe<R>
[src]fn as_any(&self) -> &dyn Any
[src]
fn datasync<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn sync<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_filetype<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<FileType, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<FileType, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_fdflags<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<FdFlags, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<FdFlags, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn set_fdflags<'life0, 'async_trait>(
&'life0 mut self,
_fdflags: FdFlags
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
_fdflags: FdFlags
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn get_filestat<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Filestat, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Filestat, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn set_filestat_size<'life0, 'async_trait>(
&'life0 self,
_size: u64
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
_size: u64
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn advise<'life0, 'async_trait>(
&'life0 self,
offset: u64,
len: u64,
advice: Advice
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
offset: u64,
len: u64,
advice: Advice
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn allocate<'life0, 'async_trait>(
&'life0 self,
offset: u64,
len: u64
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
offset: u64,
len: u64
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn read_vectored<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
bufs: &'life1 mut [IoSliceMut<'a>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
bufs: &'life1 mut [IoSliceMut<'a>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn read_vectored_at<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
bufs: &'life1 mut [IoSliceMut<'a>],
offset: u64
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
bufs: &'life1 mut [IoSliceMut<'a>],
offset: u64
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn write_vectored<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
bufs: &'life1 [IoSlice<'a>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
bufs: &'life1 [IoSlice<'a>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + '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 self,
bufs: &'life1 [IoSlice<'a>],
offset: u64
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
bufs: &'life1 [IoSlice<'a>],
offset: u64
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn seek<'life0, 'async_trait>(
&'life0 self,
pos: SeekFrom
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
pos: SeekFrom
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn peek<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut [u8]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
buf: &'life1 mut [u8]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn set_times<'life0, 'async_trait>(
&'life0 self,
atime: Option<SystemTimeSpec>,
mtime: Option<SystemTimeSpec>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
atime: Option<SystemTimeSpec>,
mtime: Option<SystemTimeSpec>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn num_ready_bytes<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn readable<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn writable<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '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,
R: Send + Sync,
impl<R> Sync for ReadPipe<R> where
R: Send + Sync,
R: Send + Sync,
impl<R> Unpin for ReadPipe<R>
impl<R> UnwindSafe for ReadPipe<R>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,