async fn dispatch_request<T: 'static>(
    client: &Client<T, Body>,
    request: &(Request<Body>, Option<Vec<u8>>),
) -> Result<IpcMessage, RequestError>
where
    T: hyper::client::connect::Connect + Clone + Sync + Send,
{
    let response = client
        .clone()
        .request(clone_request(&request.0, request.1.as_ref()))
        .await
        .map_err(|err| RequestError::Network(err))?;

    if response.status().is_success() {
        let message = IpcMessage::from_response(response)
            .await
            .map_err(|err| RequestError::Parse(err))?;
        return Ok(message);
    } else {
        Err(RequestError::BadStatus(response.status()))
    }
}
/// Internal request handler, which might fail and can be retried, as the request is being cloned on every call
Internal request handler, which might fail and can be retried, as the request is being cloned on every call
Internal request handler which might fail and can be retried as the request is being cloned on every call
async fn dispatch_request<T: 'static>(
    client: &Client<T, Body>,
    request: &(Request<Body>, Option<Vec<u8>>),
) -> Result<IpcMessage, RequestError>
where
    T: hyper::client::connect::Connect + Clone + Sync + Send,
{
    let response = client
        .clone()
        .request(clone_request(&request.0, request.1.as_ref()))
        .await
        .map_err(|err| RequestError::Network(err))?;
    if response.status().is_success() {
        let message = IpcMessage::from_response(response)
            .await
            .map_err(|err| RequestError::Parse(err))?;
        return Ok(message);
    } else {
        Err(RequestError::BadStatus(response.status()))
    }
}
async fn dispatch_request < T : ' static > ( client : & Client < T , Body > , request : & ( Request < Body > , Option < Vec < u8 > > ) , ) -> Result < IpcMessage , RequestError > where T : hyper :: client :: connect :: Connect + Clone + Sync + Send , { let response = client . clone ( ) . request ( clone_request ( & request . 0 , request . 1 . as_ref ( ) ) ) . await . map_err ( | err | RequestError :: Network ( err ) ) ? ; if response . status ( ) . is_success ( ) { let message = IpcMessage :: from_response ( response ) . await . map_err ( | err | RequestError :: Parse ( err ) ) ? ; return Ok ( message ) ; } else { Err ( RequestError :: BadStatus ( response . status ( ) ) ) } }
Internal request handler, which might fail and can be retried, as the request is being cloned on every call
Internal request handler which might fail and can be retried as the request is being cloned on every call
client
&Client<T, Body>
request
&(Request<Body>, Option<Vec<u8>>)