Skip to main content

HttpPropertyExtractor

Trait HttpPropertyExtractor 

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

    // Required methods
    fn get_listener_for_rid(
        state: &mut OpState,
        listener_rid: ResourceId,
    ) -> Result<Self::Listener, JsErrorBox>;
    fn get_connection_for_rid(
        state: &mut OpState,
        connection_rid: ResourceId,
    ) -> Result<Self::Connection, JsErrorBox>;
    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, JsErrorBox>> + '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<'a>(
        connection_properties: &'a HttpConnectionProperties,
        uri: &'a Uri,
        headers: &'a HeaderMap,
    ) -> HttpRequestProperties<'a>;
}
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, JsErrorBox>

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

Source

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

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, JsErrorBox>> + '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<'a>( connection_properties: &'a HttpConnectionProperties, uri: &'a Uri, headers: &'a HeaderMap, ) -> HttpRequestProperties<'a>

Determines the request properties.

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.

Implementors§