Skip to content

Commit

Permalink
grumbles: move RpcClientT impls
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 committed Nov 21, 2023
1 parent 1c723b0 commit 8b412e6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
38 changes: 0 additions & 38 deletions subxt/src/backend/rpc/jsonrpsee_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,41 +67,3 @@ impl RpcClientT for Client {
})
}
}

impl<T: RpcClientT> RpcClientT for std::sync::Arc<T> {
fn request_raw<'a>(
&'a self,
method: &'a str,
params: Option<Box<RawValue>>,
) -> RawRpcFuture<'a, Box<RawValue>> {
(**self).request_raw(method, params)
}

fn subscribe_raw<'a>(
&'a self,
sub: &'a str,
params: Option<Box<RawValue>>,
unsub: &'a str,
) -> RawRpcFuture<'a, RawRpcSubscription> {
(**self).subscribe_raw(sub, params, unsub)
}
}

impl<T: RpcClientT> RpcClientT for Box<T> {
fn request_raw<'a>(
&'a self,
method: &'a str,
params: Option<Box<RawValue>>,
) -> RawRpcFuture<'a, Box<RawValue>> {
(**self).request_raw(method, params)
}

fn subscribe_raw<'a>(
&'a self,
sub: &'a str,
params: Option<Box<RawValue>>,
unsub: &'a str,
) -> RawRpcFuture<'a, RawRpcSubscription> {
(**self).subscribe_raw(sub, params, unsub)
}
}
38 changes: 38 additions & 0 deletions subxt/src/backend/rpc/rpc_client_t.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,41 @@ pub struct RawRpcSubscription {
/// The ID associated with the subscription.
pub id: Option<String>,
}

impl<T: RpcClientT> RpcClientT for std::sync::Arc<T> {
fn request_raw<'a>(
&'a self,
method: &'a str,
params: Option<Box<RawValue>>,
) -> RawRpcFuture<'a, Box<RawValue>> {
(**self).request_raw(method, params)
}

fn subscribe_raw<'a>(
&'a self,
sub: &'a str,
params: Option<Box<RawValue>>,
unsub: &'a str,
) -> RawRpcFuture<'a, RawRpcSubscription> {
(**self).subscribe_raw(sub, params, unsub)
}
}

impl<T: RpcClientT> RpcClientT for Box<T> {
fn request_raw<'a>(
&'a self,
method: &'a str,
params: Option<Box<RawValue>>,
) -> RawRpcFuture<'a, Box<RawValue>> {
(**self).request_raw(method, params)
}

fn subscribe_raw<'a>(
&'a self,
sub: &'a str,
params: Option<Box<RawValue>>,
unsub: &'a str,
) -> RawRpcFuture<'a, RawRpcSubscription> {
(**self).subscribe_raw(sub, params, unsub)
}
}

0 comments on commit 8b412e6

Please sign in to comment.