Trait Host

Source
pub trait Host:
    Send
    + HostFields
    + HostIncomingRequest
    + HostOutgoingRequest
    + HostRequestOptions
    + HostResponseOutparam
    + HostIncomingResponse
    + HostIncomingBody
    + HostFutureTrailers
    + HostOutgoingResponse
    + HostOutgoingBody
    + HostFutureIncomingResponse
    + Sized
    + Send {
    // Required methods
    fn http_error_code(
        &mut self,
        err: Resource<IoError>,
    ) -> Result<Option<ErrorCode>>;
    fn convert_error_code(&mut self, err: HttpError) -> Result<ErrorCode>;
}

Required Methods§

Source

fn http_error_code( &mut self, err: Resource<IoError>, ) -> Result<Option<ErrorCode>>

Attempts to extract a http-related error from the wasi:io error provided.

Stream operations which return wasi:io/stream/stream-error::last-operation-failed have a payload of type wasi:io/error/error with more information about the operation that failed. This payload can be passed through to this function to see if there’s http-related information about the error to return.

Note that this function is fallible because not all io-errors are http-related errors.

Source

fn convert_error_code(&mut self, err: HttpError) -> Result<ErrorCode>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<_T: Host + ?Sized + Send> Host for &mut _T

Source§

fn http_error_code( &mut self, err: Resource<IoError>, ) -> Result<Option<ErrorCode>>

Attempts to extract a http-related error from the wasi:io error provided.

Stream operations which return wasi:io/stream/stream-error::last-operation-failed have a payload of type wasi:io/error/error with more information about the operation that failed. This payload can be passed through to this function to see if there’s http-related information about the error to return.

Note that this function is fallible because not all io-errors are http-related errors.

Source§

fn convert_error_code(&mut self, err: HttpError) -> Result<ErrorCode>

Implementors§

Source§

impl<T> Host for WasiHttpImpl<T>
where T: WasiHttpView,