fn single_response<T: Deref<Target = [u8]>>(response: T) -> Result<rpc::Value> {
    // For reasons beyond my comprehension, the id will fail to deserialize when
    // this library is used from graph-node, but it works just fine when I test
    // it in isolation. I can't see a reason to upstream this hack, and also
    // can't get graph-node to work without it. Id is useless over http anyway.
    let mut json: serde_json::Value =
        serde_json::from_slice(&*response).map_err(|e| Error::InvalidResponse(format!("{:?}", e)))?;
    if let Some(id) = json.get_mut("id") {
        id.take();
    }
    let response = serde_json::from_value(json).map_err(|e| Error::InvalidResponse(format!("{:?}", e)))?;
    match response {
        rpc::Response::Single(output) => helpers::to_result_from_output(output),
        _ => Err(Error::InvalidResponse("Expected single, got batch.".into())),
    }
}
/// Parse bytes RPC response into `Result`.
Parse bytes RPC response into `Result`.
Parse bytes RPC response into ` Result ` .
fn single_response<T: Deref<Target = [u8]>>(response: T) -> Result<rpc::Value> {
    // For reasons beyond my comprehension, the id will fail to deserialize when
    // this library is used from graph-node, but it works just fine when I test
    // it in isolation. I can't see a reason to upstream this hack, and also
    // can't get graph-node to work without it. Id is useless over http anyway.
    let mut json: serde_json::Value =
        serde_json::from_slice(&*response).map_err(|e| Error::InvalidResponse(format!("{:?}", e)))?;
    if let Some(id) = json.get_mut("id") {
        id.take();
    }
    let response = serde_json::from_value(json).map_err(|e| Error::InvalidResponse(format!("{:?}", e)))?;
    match response {
        rpc::Response::Single(output) => helpers::to_result_from_output(output),
        _ => Err(Error::InvalidResponse("Expected single, got batch.".into())),
    }
}
fn single_response < T : Deref < Target = [ u8 ] > > ( response : T ) -> Result < rpc :: Value > { // For reasons beyond my comprehension, the id will fail to deserialize when // this library is used from graph-node, but it works just fine when I test // it in isolation. I can't see a reason to upstream this hack, and also // can't get graph-node to work without it. Id is useless over http anyway. let mut json : serde_json :: Value = serde_json :: from_slice ( & * response ) . map_err ( | e | Error :: InvalidResponse ( format ! ( " " e ) ) ) ? ; if let Some ( id ) = json . get_mut ( " " ) { id . take ( ) ; } let response = serde_json :: from_value ( json ) . map_err ( | e | Error :: InvalidResponse ( format ! ( " " e ) ) ) ? ; match response { rpc :: Response :: Single ( output ) => helpers :: to_result_from_output ( output ) , _ => Err ( Error :: InvalidResponse ( " " . into ( ) ) ) , } }
Parse bytes RPC response into `Result`.
Parse bytes RPC response into ` Result ` .
response
T