wasmtime_wasi

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> Host for IoImpl<T>
where T: IoView,

Source§

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

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

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

Source§

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

Source§

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

Source§

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

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

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

Source§

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

Source§

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

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

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

Source§

async fn drop( &mut self, stream: Resource<Box<dyn InputStream>>, ) -> Result<(), Error>

Source§

fn read( &mut self, stream: Resource<Box<dyn InputStream>>, len: u64, ) -> Result<Vec<u8>, StreamError>

Perform a non-blocking read from the stream. Read more
Source§

async fn blocking_read( &mut self, stream: Resource<Box<dyn InputStream>>, len: u64, ) -> Result<Vec<u8>, StreamError>

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<Box<dyn InputStream>>, len: u64, ) -> Result<u64, StreamError>

Skip bytes from a stream. Returns number of bytes skipped. Read more
Source§

async fn blocking_skip( &mut self, stream: Resource<Box<dyn InputStream>>, len: u64, ) -> Result<u64, StreamError>

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<Box<dyn InputStream>>, ) -> Result<Resource<DynPollable>, Error>

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> HostInputStream for IoImpl<T>
where T: IoView,

Source§

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

Source§

fn read( &mut self, stream: Resource<InputStream>, len: u64, ) -> StreamResult<Vec<u8>>

Perform a non-blocking read from the stream. Read more
Source§

fn blocking_read( &mut self, stream: Resource<InputStream>, 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<InputStream>, len: u64) -> StreamResult<u64>

Skip bytes from a stream. Returns number of bytes skipped. Read more
Source§

fn blocking_skip( &mut self, stream: Resource<InputStream>, 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<InputStream>, ) -> Result<Resource<Pollable>>

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> HostOutputStream for IoImpl<T>
where T: IoView,

Source§

async fn drop( &mut self, stream: Resource<Box<dyn OutputStream>>, ) -> Result<(), Error>

Source§

fn check_write( &mut self, stream: Resource<Box<dyn OutputStream>>, ) -> Result<u64, StreamError>

Check readiness for writing. This function never blocks. Read more
Source§

fn write( &mut self, stream: Resource<Box<dyn OutputStream>>, bytes: Vec<u8>, ) -> Result<(), StreamError>

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

fn subscribe( &mut self, stream: Resource<Box<dyn OutputStream>>, ) -> Result<Resource<DynPollable>, Error>

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<Box<dyn OutputStream>>, bytes: Vec<u8>, ) -> Result<(), StreamError>

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<Box<dyn OutputStream>>, len: u64, ) -> Result<(), StreamError>

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<Box<dyn OutputStream>>, len: u64, ) -> Result<(), StreamError>

Write zeroes to a stream. Read more
Source§

fn flush( &mut self, stream: Resource<Box<dyn OutputStream>>, ) -> Result<(), StreamError>

Request to flush buffered output. This function never blocks. Read more
Source§

async fn blocking_flush( &mut self, stream: Resource<Box<dyn OutputStream>>, ) -> Result<(), StreamError>

Request to flush buffered output, and block until flush completes and stream is ready for writing again.
Source§

fn splice( &mut self, dest: Resource<Box<dyn OutputStream>>, src: Resource<Box<dyn InputStream>>, len: u64, ) -> Result<u64, StreamError>

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

async fn blocking_splice( &mut self, dest: Resource<Box<dyn OutputStream>>, src: Resource<Box<dyn InputStream>>, len: u64, ) -> Result<u64, StreamError>

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

impl<T> HostOutputStream for IoImpl<T>
where T: IoView,

Source§

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

Source§

fn check_write(&mut self, stream: Resource<OutputStream>) -> StreamResult<u64>

Check readiness for writing. This function never blocks. Read more
Source§

fn write( &mut self, stream: Resource<OutputStream>, bytes: Vec<u8>, ) -> StreamResult<()>

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

fn blocking_write_and_flush( &mut self, stream: Resource<OutputStream>, 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§

fn blocking_write_zeroes_and_flush( &mut self, stream: Resource<OutputStream>, 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 subscribe( &mut self, stream: Resource<OutputStream>, ) -> Result<Resource<Pollable>>

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§

fn write_zeroes( &mut self, stream: Resource<OutputStream>, len: u64, ) -> StreamResult<()>

Write zeroes to a stream. Read more
Source§

fn flush(&mut self, stream: Resource<OutputStream>) -> StreamResult<()>

Request to flush buffered output. This function never blocks. Read more
Source§

fn blocking_flush(&mut self, stream: Resource<OutputStream>) -> StreamResult<()>

Request to flush buffered output, and block until flush completes and stream is ready for writing again.
Source§

fn splice( &mut self, dst: Resource<OutputStream>, src: Resource<InputStream>, len: u64, ) -> StreamResult<u64>

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

fn blocking_splice( &mut self, dst: Resource<OutputStream>, src: Resource<InputStream>, len: u64, ) -> StreamResult<u64>

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

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

Source§

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

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

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

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

Source§

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

Source§

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

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

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

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

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

Source§

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

Source§

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

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

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

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.

§

impl<T> GetSetFdFlags for T

§

fn get_fd_flags(&self) -> Result<FdFlags, Error>
where T: AsFilelike,

Query the “status” flags for the self file descriptor.
§

fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>
where T: AsFilelike,

Create a new SetFdFlags value for use with set_fd_flags. Read more
§

fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>
where T: AsFilelike,

Set the “status” flags for the self file descriptor. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> Pointee for T

§

type Pointer = u32

§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T