pub trait HttpPropertyExtractor {
    type Listener: 'static;
    type Connection;

    // Required methods
    fn get_listener_for_rid(
        state: &mut OpState,
        listener_rid: ResourceId
    ) -> Result<Self::Listener, AnyError>;
    fn get_connection_for_rid(
        state: &mut OpState,
        connection_rid: ResourceId
    ) -> Result<Self::Connection, AnyError>;
    fn listen_properties_from_listener(
        listener: &Self::Listener
    ) -> Result<HttpListenProperties, Error>;
    fn listen_properties_from_connection(
        connection: &Self::Connection
    ) -> Result<HttpListenProperties, Error>;
    fn accept_connection_from_listener<'life0, 'async_trait>(
        listener: &'life0 Self::Listener
    ) -> Pin<Box<dyn Future<Output = Result<Self::Connection, AnyError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn connection_properties(
        listen_properties: &HttpListenProperties,
        connection: &Self::Connection
    ) -> HttpConnectionProperties;
    fn to_network_stream_from_connection(
        connection: Self::Connection
    ) -> NetworkStream;
    fn request_properties(
        connection_properties: &HttpConnectionProperties,
        uri: &Uri,
        headers: &HeaderMap
    ) -> HttpRequestProperties;
}
Expand description

Pluggable trait to determine listen, connection and request properties for embedders that wish to provide alternative routes for incoming HTTP.

Required Associated Types§

Required Methods§

source

fn get_listener_for_rid( state: &mut OpState, listener_rid: ResourceId ) -> Result<Self::Listener, AnyError>

Given a listener ResourceId, returns the HttpPropertyExtractor::Listener.

source

fn get_connection_for_rid( state: &mut OpState, connection_rid: ResourceId ) -> Result<Self::Connection, AnyError>

Given a connection ResourceId, returns the HttpPropertyExtractor::Connection.

source

fn listen_properties_from_listener( listener: &Self::Listener ) -> Result<HttpListenProperties, Error>

Determines the listener properties.

source

fn listen_properties_from_connection( connection: &Self::Connection ) -> Result<HttpListenProperties, Error>

Determines the listener properties given a HttpPropertyExtractor::Connection.

source

fn accept_connection_from_listener<'life0, 'async_trait>( listener: &'life0 Self::Listener ) -> Pin<Box<dyn Future<Output = Result<Self::Connection, AnyError>> + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

source

fn connection_properties( listen_properties: &HttpListenProperties, connection: &Self::Connection ) -> HttpConnectionProperties

Determines the connection properties.

source

fn to_network_stream_from_connection( connection: Self::Connection ) -> NetworkStream

source

fn request_properties( connection_properties: &HttpConnectionProperties, uri: &Uri, headers: &HeaderMap ) -> HttpRequestProperties

Determines the request properties.

Implementors§