pub struct BatchingTransport { /* private fields */ }Expand description
Auto-batching transport wrapper.
Sends a flush task in the background that groups pending requests into
a single batch call every window milliseconds.
Implementations§
Source§impl BatchingTransport
impl BatchingTransport
Sourcepub fn new(
inner: Arc<dyn RpcTransport>,
window: Duration,
) -> Arc<BatchingTransport>
pub fn new( inner: Arc<dyn RpcTransport>, window: Duration, ) -> Arc<BatchingTransport>
Create a new batching transport wrapping inner.
Trait Implementations§
Source§impl RpcTransport for BatchingTransport
impl RpcTransport for BatchingTransport
Source§fn send<'life0, 'async_trait>(
&'life0 self,
req: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
BatchingTransport: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
req: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
BatchingTransport: 'async_trait,
Send a single JSON-RPC request and return the response.
Source§fn health(&self) -> HealthStatus
fn health(&self) -> HealthStatus
Return the current health status of this transport.
Source§fn send_batch<'life0, 'async_trait>(
&'life0 self,
reqs: Vec<JsonRpcRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JsonRpcResponse>, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn send_batch<'life0, 'async_trait>(
&'life0 self,
reqs: Vec<JsonRpcRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<JsonRpcResponse>, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Send a batch of JSON-RPC requests. Read more
Source§fn call<'life0, 'life1, 'async_trait, T>(
&'life0 self,
id: u64,
method: &'life1 str,
params: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<T, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sized + 'async_trait,
T: 'async_trait + DeserializeOwned,
fn call<'life0, 'life1, 'async_trait, T>(
&'life0 self,
id: u64,
method: &'life1 str,
params: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<T, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sized + 'async_trait,
T: 'async_trait + DeserializeOwned,
Convenience: call a method and deserialize the result.
Auto Trait Implementations§
impl Freeze for BatchingTransport
impl !RefUnwindSafe for BatchingTransport
impl Send for BatchingTransport
impl Sync for BatchingTransport
impl Unpin for BatchingTransport
impl UnsafeUnpin for BatchingTransport
impl !UnwindSafe for BatchingTransport
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