use std::convert::Infallible;
use bytes::Bytes;
use http_body_util::combinators::BoxBody;
use hyper::{Request, Response};
use prosa::core::{error::ProcError, service::ServiceError};
use url::Url;
use crate::client::proc::HyperClientProc;
#[cfg_attr(doc, aquamarine::aquamarine)]
pub trait HyperClientAdaptor<M>
where
M: 'static
+ std::marker::Send
+ std::marker::Sync
+ std::marker::Sized
+ std::clone::Clone
+ std::fmt::Debug
+ prosa::core::msg::Tvf
+ std::default::Default,
{
fn new(proc: &HyperClientProc<M>) -> Result<Self, Box<dyn ProcError + Send + Sync>>
where
Self: Sized;
fn process_srv_request(
&self,
request: M,
socket_url: &Url,
) -> Result<Request<BoxBody<Bytes, Infallible>>, ServiceError>;
fn process_http_response(
&self,
resp: Result<Response<hyper::body::Incoming>, hyper::Error>,
) -> impl std::future::Future<Output = Result<M, ServiceError>> + Send;
}