Trait rustjs::deno_http::HttpPropertyExtractor

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

    // Required methods
    fn get_listener_for_rid(
        state: &mut OpState,
        listener_rid: u32,
    ) -> Result<Self::Listener, Error>;
    fn get_connection_for_rid(
        state: &mut OpState,
        connection_rid: u32,
    ) -> Result<Self::Connection, Error>;
    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, Error>> + 'async_trait>>
       where 'life0: 'async_trait,
             Self: '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: u32, ) -> Result<Self::Listener, Error>

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

source

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

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, Error>> + 'async_trait>>
where 'life0: 'async_trait, Self: '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.

Object Safety§

This trait is not object safe.

Implementors§