From 68967f9fb3f8ab93a2a80723820876913ec70717 Mon Sep 17 00:00:00 2001 From: Ruediger Klaehn Date: Mon, 31 Mar 2025 14:14:30 +0300 Subject: [PATCH] Add fn boxed to client... ...so there is an easy way to get rid of the annoying type parameter --- src/rpc/client/blobs.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/rpc/client/blobs.rs b/src/rpc/client/blobs.rs index 633034c8d..e5f5acee6 100644 --- a/src/rpc/client/blobs.rs +++ b/src/rpc/client/blobs.rs @@ -74,6 +74,7 @@ use iroh::NodeAddr; use portable_atomic::{AtomicU64, Ordering}; use quic_rpc::{ client::{BoxStreamSync, BoxedConnector}, + transport::boxed::BoxableConnector, Connector, RpcClient, }; use serde::{Deserialize, Serialize}; @@ -87,7 +88,7 @@ use crate::{ format::collection::{Collection, SimpleStore}, get::db::DownloadProgress as BytesDownloadProgress, net_protocol::BlobDownloadRequest, - rpc::proto::RpcService, + rpc::proto::{Request, Response, RpcService}, store::{BaoBlobSize, ConsistencyCheckProgress, ExportFormat, ExportMode, ValidateProgress}, util::SetTagOption, BlobFormat, Hash, Tag, @@ -108,7 +109,7 @@ use crate::rpc::proto::blobs::{ #[derive(Debug, Clone)] #[repr(transparent)] pub struct Client> { - pub(super) rpc: RpcClient, + pub(crate) rpc: RpcClient, } /// Type alias for a memory-backed client. @@ -123,6 +124,14 @@ where Self { rpc } } + /// Box the client to avoid having to provide the connector type. + pub fn boxed(&self) -> Client> + where + C: BoxableConnector, + { + Client::new(self.rpc.clone().boxed()) + } + /// Get a tags client. pub fn tags(&self) -> tags::Client { tags::Client::new(self.rpc.clone())