Trait HyperServerAdaptor

Source
pub trait HyperServerAdaptor<M>
where M: 'static + Send + Sync + Sized + Clone + Debug + Tvf + Default,
{ const SERVER_HEADER: &'static str = "ProSA-Hyper/0.2.0 (Unix)"; // Required methods fn new( proc: &HyperServerProc<M>, prosa_name: &str, ) -> Result<Self, Box<dyn ProcError + Send + Sync>> where Self: Sized; fn process_http_request( &self, req: Request<Incoming>, ) -> impl Future<Output = HyperResp<M>> + Send; fn process_srv_response( &self, resp: M, ) -> Response<BoxBody<Bytes, Infallible>>; }
Expand description

Trait to define the Hyper adaptor structure

graph LR IN[Input HTTP server] ProSA[ProSA Hyper Procesor] IN-- HTTP request (process_server_request) -->ProSA ProSA-- HTTP response (process_server_response) -->IN

Provided Associated Constants§

Source

const SERVER_HEADER: &'static str = "ProSA-Hyper/0.2.0 (Unix)"

Server header value send by the server

Required Methods§

Source

fn new( proc: &HyperServerProc<M>, prosa_name: &str, ) -> Result<Self, Box<dyn ProcError + Send + Sync>>
where Self: Sized,

Create a new adaptor

Source

fn process_http_request( &self, req: Request<Incoming>, ) -> impl Future<Output = HyperResp<M>> + Send

Method to process input HTTP requests. Received by the ProSA through Hyper

Source

fn process_srv_response(&self, resp: M) -> Response<BoxBody<Bytes, Infallible>>

Method to process input response to respond with an Hyper HTTP 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.

Implementors§