#[repr(transparent)]pub struct IoImpl<T>(pub T);Expand description
A small newtype wrapper which serves as the basis for implementations of
Host WASI traits in this crate.
This type is used as the basis for the implementation of all Host traits
generated by bindgen! for WASI interfaces.
You don’t need to use this type if you are using the root
add_to_linker_async in this crate.
If you’re calling the add_to_linker functions generated by bindgen!
from the bindings module, you’ll want to create a
value of this type in the closures added to a Linker.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: IoView> Host for IoImpl<T>
impl<T: IoView> Host for IoImpl<T>
fn convert_stream_error(&mut self, err: StreamError) -> Result<StreamError>
Source§impl<T: IoView> HostInputStream for IoImpl<T>
impl<T: IoView> HostInputStream for IoImpl<T>
async fn drop(&mut self, stream: Resource<DynInputStream>) -> Result<()>
Source§fn read(
&mut self,
stream: Resource<DynInputStream>,
len: u64,
) -> StreamResult<Vec<u8>>
fn read( &mut self, stream: Resource<DynInputStream>, len: u64, ) -> StreamResult<Vec<u8>>
Perform a non-blocking read from the stream. Read more
Source§async fn blocking_read(
&mut self,
stream: Resource<DynInputStream>,
len: u64,
) -> StreamResult<Vec<u8>>
async fn blocking_read( &mut self, stream: Resource<DynInputStream>, len: u64, ) -> StreamResult<Vec<u8>>
Read bytes from a stream, after blocking until at least one byte can
be read. Except for blocking, behavior is identical to
read.Source§fn skip(
&mut self,
stream: Resource<DynInputStream>,
len: u64,
) -> StreamResult<u64>
fn skip( &mut self, stream: Resource<DynInputStream>, len: u64, ) -> StreamResult<u64>
Skip bytes from a stream. Returns number of bytes skipped. Read more
Source§async fn blocking_skip(
&mut self,
stream: Resource<DynInputStream>,
len: u64,
) -> StreamResult<u64>
async fn blocking_skip( &mut self, stream: Resource<DynInputStream>, len: u64, ) -> StreamResult<u64>
Skip bytes from a stream, after blocking until at least one byte
can be skipped. Except for blocking behavior, identical to
skip.Source§fn subscribe(
&mut self,
stream: Resource<DynInputStream>,
) -> Result<Resource<DynPollable>>
fn subscribe( &mut self, stream: Resource<DynInputStream>, ) -> Result<Resource<DynPollable>>
Create a
pollable which will resolve once either the specified stream
has bytes available to read or the other end of the stream has been
closed.
The created pollable is a child resource of the input-stream.
Implementations may trap if the input-stream is dropped before
all derived pollables created with this function are dropped.Source§impl<T: IoView> HostOutputStream for IoImpl<T>
impl<T: IoView> HostOutputStream for IoImpl<T>
async fn drop(&mut self, stream: Resource<DynOutputStream>) -> Result<()>
Source§fn check_write(
&mut self,
stream: Resource<DynOutputStream>,
) -> StreamResult<u64>
fn check_write( &mut self, stream: Resource<DynOutputStream>, ) -> StreamResult<u64>
Check readiness for writing. This function never blocks. Read more
Source§fn write(
&mut self,
stream: Resource<DynOutputStream>,
bytes: Vec<u8>,
) -> StreamResult<()>
fn write( &mut self, stream: Resource<DynOutputStream>, bytes: Vec<u8>, ) -> StreamResult<()>
Perform a write. This function never blocks. Read more
Source§fn subscribe(
&mut self,
stream: Resource<DynOutputStream>,
) -> Result<Resource<DynPollable>>
fn subscribe( &mut self, stream: Resource<DynOutputStream>, ) -> Result<Resource<DynPollable>>
Create a
pollable which will resolve once the output-stream
is ready for more writing, or an error has occurred. When this
pollable is ready, check-write will return ok(n) with n>0, or an
error. Read moreSource§async fn blocking_write_and_flush(
&mut self,
stream: Resource<DynOutputStream>,
bytes: Vec<u8>,
) -> StreamResult<()>
async fn blocking_write_and_flush( &mut self, stream: Resource<DynOutputStream>, bytes: Vec<u8>, ) -> StreamResult<()>
Perform a write of up to 4096 bytes, and then flush the stream. Block
until all of these operations are complete, or an error occurs. Read more
Source§async fn blocking_write_zeroes_and_flush(
&mut self,
stream: Resource<DynOutputStream>,
len: u64,
) -> StreamResult<()>
async fn blocking_write_zeroes_and_flush( &mut self, stream: Resource<DynOutputStream>, len: u64, ) -> StreamResult<()>
Perform a write of up to 4096 zeroes, and then flush the stream.
Block until all of these operations are complete, or an error
occurs. Read more
Source§fn write_zeroes(
&mut self,
stream: Resource<DynOutputStream>,
len: u64,
) -> StreamResult<()>
fn write_zeroes( &mut self, stream: Resource<DynOutputStream>, len: u64, ) -> StreamResult<()>
Write zeroes to a stream. Read more
Source§fn flush(&mut self, stream: Resource<DynOutputStream>) -> StreamResult<()>
fn flush(&mut self, stream: Resource<DynOutputStream>) -> StreamResult<()>
Request to flush buffered output. This function never blocks. Read more
Source§async fn blocking_flush(
&mut self,
stream: Resource<DynOutputStream>,
) -> StreamResult<()>
async fn blocking_flush( &mut self, stream: Resource<DynOutputStream>, ) -> StreamResult<()>
Request to flush buffered output, and block until flush completes
and stream is ready for writing again.
Source§fn splice(
&mut self,
dest: Resource<DynOutputStream>,
src: Resource<DynInputStream>,
len: u64,
) -> StreamResult<u64>
fn splice( &mut self, dest: Resource<DynOutputStream>, src: Resource<DynInputStream>, len: u64, ) -> StreamResult<u64>
Read from one stream and write to another. Read more
Source§async fn blocking_splice(
&mut self,
dest: Resource<DynOutputStream>,
src: Resource<DynInputStream>,
len: u64,
) -> StreamResult<u64>
async fn blocking_splice( &mut self, dest: Resource<DynOutputStream>, src: Resource<DynInputStream>, len: u64, ) -> StreamResult<u64>
Read from one stream and write to another, with blocking. Read more
Source§impl<T: IoView> HostPollable for IoImpl<T>
impl<T: IoView> HostPollable for IoImpl<T>
Source§async fn block(&mut self, pollable: Resource<DynPollable>) -> Result<()>
async fn block(&mut self, pollable: Resource<DynPollable>) -> Result<()>
block returns immediately if the pollable is ready, and otherwise
blocks until ready. Read moreSource§async fn ready(&mut self, pollable: Resource<DynPollable>) -> Result<bool>
async fn ready(&mut self, pollable: Resource<DynPollable>) -> Result<bool>
Return the readiness of a pollable. This function never blocks. Read more
fn drop(&mut self, pollable: Resource<DynPollable>) -> Result<()>
Source§impl<T: IoView> IoView for IoImpl<T>
impl<T: IoView> IoView for IoImpl<T>
Source§fn table(&mut self) -> &mut ResourceTable
fn table(&mut self) -> &mut ResourceTable
Yields mutable access to the internal resource management that this
context contains. Read more
impl<T: IoView> Host for IoImpl<T>
Auto Trait Implementations§
impl<T> Freeze for IoImpl<T>where
T: Freeze,
impl<T> RefUnwindSafe for IoImpl<T>where
T: RefUnwindSafe,
impl<T> Send for IoImpl<T>where
T: Send,
impl<T> Sync for IoImpl<T>where
T: Sync,
impl<T> Unpin for IoImpl<T>where
T: Unpin,
impl<T> UnwindSafe for IoImpl<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more