pub trait HyperServerAdaptor<M>{
const SERVER_HEADER: &'static str = "ProSA-Hyper/0.1.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§
Sourceconst SERVER_HEADER: &'static str = "ProSA-Hyper/0.1.0 (Unix)"
const SERVER_HEADER: &'static str = "ProSA-Hyper/0.1.0 (Unix)"
Server header value send by the server
Required Methods§
Sourcefn new(
proc: &HyperServerProc<M>,
prosa_name: &str,
) -> Result<Self, Box<dyn ProcError + Send + Sync>>where
Self: Sized,
fn new(
proc: &HyperServerProc<M>,
prosa_name: &str,
) -> Result<Self, Box<dyn ProcError + Send + Sync>>where
Self: Sized,
Create a new adaptor
Sourcefn process_http_request(
&self,
req: Request<Incoming>,
) -> impl Future<Output = HyperResp<M>> + Send
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
Sourcefn process_srv_response(&self, resp: &M) -> Response<BoxBody<Bytes, Infallible>>
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.