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§
type Listener: 'static
type Connection
Required Methods§
Sourcefn get_listener_for_rid(
state: &mut OpState,
listener_rid: ResourceId,
) -> Result<Self::Listener, JsErrorBox>
fn get_listener_for_rid( state: &mut OpState, listener_rid: ResourceId, ) -> Result<Self::Listener, JsErrorBox>
Given a listener ResourceId, returns the HttpPropertyExtractor::Listener.
Sourcefn get_connection_for_rid(
state: &mut OpState,
connection_rid: ResourceId,
) -> Result<Self::Connection, JsErrorBox>
fn get_connection_for_rid( state: &mut OpState, connection_rid: ResourceId, ) -> Result<Self::Connection, JsErrorBox>
Given a connection ResourceId, returns the HttpPropertyExtractor::Connection.
Sourcefn listen_properties_from_listener(
listener: &Self::Listener,
) -> Result<HttpListenProperties, Error>
fn listen_properties_from_listener( listener: &Self::Listener, ) -> Result<HttpListenProperties, Error>
Determines the listener properties.
Sourcefn listen_properties_from_connection(
connection: &Self::Connection,
) -> Result<HttpListenProperties, Error>
fn listen_properties_from_connection( connection: &Self::Connection, ) -> Result<HttpListenProperties, Error>
Determines the listener properties given a HttpPropertyExtractor::Connection.
Sourcefn 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 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,
Accept a new HttpPropertyExtractor::Connection from the given listener HttpPropertyExtractor::Listener.
Sourcefn connection_properties(
listen_properties: &HttpListenProperties,
connection: &Self::Connection,
) -> HttpConnectionProperties
fn connection_properties( listen_properties: &HttpListenProperties, connection: &Self::Connection, ) -> HttpConnectionProperties
Determines the connection properties.
Sourcefn to_network_stream_from_connection(
connection: Self::Connection,
) -> NetworkStream
fn to_network_stream_from_connection( connection: Self::Connection, ) -> NetworkStream
Turn a given HttpPropertyExtractor::Connection into a NetworkStream.
Sourcefn request_properties<'a>(
connection_properties: &'a HttpConnectionProperties,
uri: &'a Uri,
headers: &'a HeaderMap,
) -> HttpRequestProperties<'a>
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.