Struct wasi_common::pipe::ReadPipe [−][src]
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]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn as_any(&self) -> &dyn Any
[src]
fn datasync(&self) -> Result<(), Error>
[src]
fn sync(&self) -> Result<(), Error>
[src]
fn get_filetype(&self) -> Result<FileType, Error>
[src]
fn get_fdflags(&self) -> Result<FdFlags, Error>
[src]
fn set_fdflags(&mut self, _fdflags: FdFlags) -> Result<(), Error>
[src]
fn get_filestat(&self) -> Result<Filestat, Error>
[src]
fn set_filestat_size(&self, _size: u64) -> Result<(), Error>
[src]
fn advise(&self, offset: u64, len: u64, advice: Advice) -> Result<(), Error>
[src]
fn allocate(&self, offset: u64, len: u64) -> Result<(), Error>
[src]
fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<u64, Error>
[src]
fn read_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<u64, Error>
[src]
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<u64, Error>
fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<u64, Error>
[src]
fn write_vectored_at(
&self,
bufs: &[IoSlice<'_>],
offset: u64
) -> Result<u64, Error>
[src]
&self,
bufs: &[IoSlice<'_>],
offset: u64
) -> Result<u64, Error>
fn seek(&self, pos: SeekFrom) -> Result<u64, Error>
[src]
fn peek(&self, buf: &mut [u8]) -> Result<u64, Error>
[src]
fn set_times(
&self,
atime: Option<SystemTimeSpec>,
mtime: Option<SystemTimeSpec>
) -> Result<(), Error>
[src]
&self,
atime: Option<SystemTimeSpec>,
mtime: Option<SystemTimeSpec>
) -> Result<(), Error>
fn num_ready_bytes(&self) -> Result<u64, Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointee for T
[src]
type Pointer = u32
pub fn debug(
pointer: <T as Pointee>::Pointer,
f: &mut Formatter<'_>
) -> Result<(), Error>
[src]
pointer: <T as Pointee>::Pointer,
f: &mut Formatter<'_>
) -> Result<(), Error>
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,