pub struct DedupTransport { /* private fields */ }Expand description
Deduplicates identical in-flight RPC requests.
If two tasks call send() with the same (method, params) at the same
time, only one transport call is made. Both tasks receive a clone of the
response (or the same error message).
Implementations§
Source§impl DedupTransport
impl DedupTransport
Sourcepub fn new(inner: Arc<dyn RpcTransport>) -> Self
pub fn new(inner: Arc<dyn RpcTransport>) -> Self
Wrap an inner transport with request deduplication.
Sourcepub async fn send(
&self,
req: JsonRpcRequest,
) -> Result<JsonRpcResponse, TransportError>
pub async fn send( &self, req: JsonRpcRequest, ) -> Result<JsonRpcResponse, TransportError>
Send a request, deduplicating identical in-flight requests.
Sourcepub fn in_flight_count(&self) -> usize
pub fn in_flight_count(&self) -> usize
Number of currently in-flight deduplicated requests.
Auto Trait Implementations§
impl !Freeze for DedupTransport
impl !RefUnwindSafe for DedupTransport
impl Send for DedupTransport
impl Sync for DedupTransport
impl Unpin for DedupTransport
impl UnsafeUnpin for DedupTransport
impl !UnwindSafe for DedupTransport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more