remove unused things

This commit is contained in:
Bryan Stitt 2023-10-17 00:46:06 -07:00
parent e2ff199d82
commit 1e707251ef
2 changed files with 3 additions and 10 deletions

@ -6,7 +6,6 @@ use axum::body::StreamBody;
use axum::response::IntoResponse;
use axum::Json;
use bytes::{Bytes, BytesMut};
use derivative::Derivative;
use futures_util::stream::{self, StreamExt};
use futures_util::TryStreamExt;
use serde::{de, Deserialize, Serialize};
@ -20,7 +19,7 @@ pub trait JsonRpcResultData = serde::Serialize + serde::de::DeserializeOwned + f
/// TODO: borrow values to avoid allocs if possible
/// TODO: lots of overlap with `SingleForwardedResponse`
#[derive(Clone, Debug, Serialize)]
#[derive(Debug, Serialize)]
pub struct ParsedResponse<T = Arc<RawValue>> {
pub jsonrpc: String,
pub id: Box<RawValue>,
@ -201,13 +200,11 @@ pub enum ResponsePayload<T> {
Error { error: JsonRpcErrorData },
}
#[derive(Derivative)]
#[derivative(Debug)]
#[derive(Debug)]
pub struct StreamResponse<T> {
_t: PhantomData<T>,
buffer: Bytes,
num_bytes: Option<u64>,
#[derivative(Debug = "ignore")]
response: reqwest::Response,
web3_request: Arc<ValidatedRequest>,
}

@ -90,7 +90,6 @@ pub type JsonRpcResponseCache = Cache<u64, ForwardedResponse<Arc<RawValue>>>;
/// TODO: think about this more. there is a lot of overlap with ParsedResponse
#[derive(Clone, Debug)]
pub enum ForwardedResponse<T> {
NullResult,
Result {
value: T,
num_bytes: u64,
@ -105,7 +104,6 @@ pub enum ForwardedResponse<T> {
impl<R> ForwardedResponse<R> {
pub fn num_bytes(&self) -> u64 {
match self {
Self::NullResult => 1,
Self::Result { num_bytes, .. } => *num_bytes,
Self::RpcError { num_bytes, .. } => *num_bytes,
}
@ -113,7 +111,6 @@ impl<R> ForwardedResponse<R> {
pub fn is_error(&self) -> bool {
match self {
Self::NullResult => false,
Self::Result { .. } => false,
Self::RpcError { .. } => true,
}
@ -122,14 +119,13 @@ impl<R> ForwardedResponse<R> {
impl<R> ForwardedResponse<Option<R>> {
pub fn is_null(&self) -> bool {
matches!(self, Self::NullResult | Self::Result { value: None, .. })
matches!(self, Self::Result { value: None, .. })
}
}
impl ForwardedResponse<Arc<RawValue>> {
pub fn is_null(&self) -> bool {
match self {
Self::NullResult => true,
Self::Result { value, .. } => value.get() == "null",
_ => false,
}