Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci committed Nov 16, 2023
1 parent c6c7983 commit a9e77e8
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/middlewares/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,20 @@ pub mod factory;
pub mod methods;
pub mod subscriptions;

#[derive(Debug)]
/// Represents a RPC request made to a middleware function.
pub struct CallRequest {
pub method: String,
pub params: Vec<JsonValue>,
pub tracer: Option<opentelemetry::global::BoxedTracer>,
}

impl CallRequest {
pub fn new(method: impl ToString, params: Vec<JsonValue>) -> Self {
Self {
method: method.to_string(),
params,
tracer: None,
}
}

pub fn with_tracer(mut self, tracer: opentelemetry::global::BoxedTracer) -> Self {
self.tracer = Some(tracer);
self
}
}

impl Debug for CallRequest {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct("CallRequest")
.field("method", &self.method)
.field("params", &self.params)
.finish()
}
}

/// Alias for the result of a method request.
Expand Down

0 comments on commit a9e77e8

Please sign in to comment.