wasmtime_wasi_http

Trait WasiHttpView

source
pub trait WasiHttpView {
    // Required methods
    fn ctx(&mut self) -> &mut WasiHttpCtx;
    fn table(&mut self) -> &mut ResourceTable;

    // Provided methods
    fn new_incoming_request(
        &mut self,
        req: Request<HyperIncomingBody>,
    ) -> Result<Resource<HostIncomingRequest>>
       where Self: Sized { ... }
    fn new_response_outparam(
        &mut self,
        result: Sender<Result<Response<HyperOutgoingBody>, ErrorCode>>,
    ) -> Result<Resource<HostResponseOutparam>> { ... }
    fn send_request(
        &mut self,
        request: Request<HyperOutgoingBody>,
        config: OutgoingRequestConfig,
    ) -> HttpResult<HostFutureIncomingResponse> { ... }
    fn is_forbidden_header(&mut self, _name: &HeaderName) -> bool { ... }
}
Expand description

A trait which provides internal WASI HTTP state.

Required Methods§

source

fn ctx(&mut self) -> &mut WasiHttpCtx

Returns a mutable reference to the WASI HTTP context.

source

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

Returns a mutable reference to the WASI HTTP resource table.

Provided Methods§

source

fn new_incoming_request( &mut self, req: Request<HyperIncomingBody>, ) -> Result<Resource<HostIncomingRequest>>
where Self: Sized,

Create a new incoming request resource.

source

fn new_response_outparam( &mut self, result: Sender<Result<Response<HyperOutgoingBody>, ErrorCode>>, ) -> Result<Resource<HostResponseOutparam>>

Create a new outgoing response resource.

source

fn send_request( &mut self, request: Request<HyperOutgoingBody>, config: OutgoingRequestConfig, ) -> HttpResult<HostFutureIncomingResponse>

Send an outgoing request.

source

fn is_forbidden_header(&mut self, _name: &HeaderName) -> bool

Whether a given header should be considered forbidden and not allowed.

Implementations on Foreign Types§

source§

impl<T: ?Sized + WasiHttpView> WasiHttpView for &mut T

Implementors§