wasmtime_wasi_io

Struct IoImpl

Source
#[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: T

Trait Implementations§

Source§

impl<T: IoView> Host for IoImpl<T>

Source§

async fn poll( &mut self, pollables: Vec<Resource<DynPollable>>, ) -> Result<Vec<u32>>

Poll for completion on a set of pollables. Read more
Source§

impl<T: IoView> Host for IoImpl<T>

Source§

impl<T: IoView> HostError for IoImpl<T>

Source§

fn drop(&mut self, err: Resource<Error>) -> Result<()>

Source§

fn to_debug_string(&mut self, err: Resource<Error>) -> Result<String>

Returns a string that is suitable to assist humans in debugging this error. Read more
Source§

impl<T: IoView> HostInputStream for IoImpl<T>

Source§

async fn drop(&mut self, stream: Resource<DynInputStream>) -> Result<()>

Source§

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>>

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>

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>

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>>

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>

Source§

async fn drop(&mut self, stream: Resource<DynOutputStream>) -> Result<()>

Source§

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<()>

Perform a write. This function never blocks. Read more
Source§

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 more
Source§

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<()>

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<()>

Write zeroes to a stream. Read more
Source§

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<()>

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>

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>

Read from one stream and write to another, with blocking. Read more
Source§

impl<T: IoView> HostPollable for IoImpl<T>

Source§

async fn block(&mut self, pollable: Resource<DynPollable>) -> Result<()>

block returns immediately if the pollable is ready, and otherwise blocks until ready. Read more
Source§

async fn ready(&mut self, pollable: Resource<DynPollable>) -> Result<bool>

Return the readiness of a pollable. This function never blocks. Read more
Source§

fn drop(&mut self, pollable: Resource<DynPollable>) -> Result<()>

Source§

impl<T: IoView> IoView for IoImpl<T>

Source§

fn table(&mut self) -> &mut ResourceTable

Yields mutable access to the internal resource management that this context contains. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.