Host

Trait Host 

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

Required Methods§

Source

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

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

Implementations on Foreign Types§

Source§

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

Source§

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

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

Implementors§

Source§

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