Trait Host

Source
pub trait Host: Send + Send {
    // Required method
    fn handle(
        &mut self,
        request: Resource<OutgoingRequest>,
        options: Option<Resource<RequestOptions>>,
    ) -> impl Future<Output = Result<Result<Resource<FutureIncomingResponse>, ErrorCode>>> + Send;
}

Required Methods§

Source

fn handle( &mut self, request: Resource<OutgoingRequest>, options: Option<Resource<RequestOptions>>, ) -> impl Future<Output = Result<Result<Resource<FutureIncomingResponse>, ErrorCode>>> + Send

This function is invoked with an outgoing HTTP Request, and it returns a resource future-incoming-response which represents an HTTP Response which may arrive in the future.

The options argument accepts optional parameters for the HTTP protocol’s transport layer.

This function may return an error if the outgoing-request is invalid or not allowed to be made. Otherwise, protocol errors are reported through the future-incoming-response.

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§

async fn handle( &mut self, request: Resource<OutgoingRequest>, options: Option<Resource<RequestOptions>>, ) -> Result<Result<Resource<FutureIncomingResponse>, ErrorCode>>

This function is invoked with an outgoing HTTP Request, and it returns a resource future-incoming-response which represents an HTTP Response which may arrive in the future.

The options argument accepts optional parameters for the HTTP protocol’s transport layer.

This function may return an error if the outgoing-request is invalid or not allowed to be made. Otherwise, protocol errors are reported through the future-incoming-response.

Implementors§