fn batch_response<T: Deref<Target = [u8]>>(response: T) -> Result<Vec<Result<rpc::Value>>> {
    // See comment in `single_response`.
    let mut json: Vec<serde_json::Value> =
        serde_json::from_slice(&*response).map_err(|e| Error::InvalidResponse(format!("{:?}", e)))?;
    for value in &mut json {
        if let Some(id) = value.get_mut("id") {
            id.take();
        }
    }
    let response = serde_json::from_value(serde_json::Value::Array(json))
        .map_err(|e| Error::InvalidResponse(format!("{:?}", e)))?;
    match response {
        rpc::Response::Batch(outputs) => Ok(outputs.into_iter().map(helpers::to_result_from_output).collect()),
        _ => Err(Error::InvalidResponse("Expected batch, got single.".into())),
    }
}
/// Parse bytes RPC batch response into `Result`.
Parse bytes RPC batch response into `Result`.
Parse bytes RPC batch response into ` Result ` .
fn batch_response<T: Deref<Target = [u8]>>(response: T) -> Result<Vec<Result<rpc::Value>>> {
    // See comment in `single_response`.
    let mut json: Vec<serde_json::Value> =
        serde_json::from_slice(&*response).map_err(|e| Error::InvalidResponse(format!("{:?}", e)))?;
    for value in &mut json {
        if let Some(id) = value.get_mut("id") {
            id.take();
        }
    }
    let response = serde_json::from_value(serde_json::Value::Array(json))
        .map_err(|e| Error::InvalidResponse(format!("{:?}", e)))?;
    match response {
        rpc::Response::Batch(outputs) => Ok(outputs.into_iter().map(helpers::to_result_from_output).collect()),
        _ => Err(Error::InvalidResponse("Expected batch, got single.".into())),
    }
}
fn batch_response < T : Deref < Target = [ u8 ] > > ( response : T ) -> Result < Vec < Result < rpc :: Value > > > { // See comment in `single_response`. let mut json : Vec < serde_json :: Value > = serde_json :: from_slice ( & * response ) . map_err ( | e | Error :: InvalidResponse ( format ! ( " " e ) ) ) ? ; for value in & mut json { if let Some ( id ) = value . get_mut ( " " ) { id . take ( ) ; } } let response = serde_json :: from_value ( serde_json :: Value :: Array ( json ) ) . map_err ( | e | Error :: InvalidResponse ( format ! ( " " e ) ) ) ? ; match response { rpc :: Response :: Batch ( outputs ) => Ok ( outputs . into_iter ( ) . map ( helpers :: to_result_from_output ) . collect ( ) ) , _ => Err ( Error :: InvalidResponse ( " " . into ( ) ) ) , } }
Parse bytes RPC batch response into `Result`.
Parse bytes RPC batch response into ` Result ` .
response
T