Struct ethcontract::batch::CallBatch
source · pub struct CallBatch<T: Web3BatchTransport> { /* private fields */ }Expand description
Struct allowing to batch multiple calls into a single Node request
Implementations§
source§impl<T: Web3BatchTransport> CallBatch<T>
impl<T: Web3BatchTransport> CallBatch<T>
sourcepub fn push(
&mut self,
call: CallRequest,
block: Option<BlockId>
) -> impl Future<Output = Result<Bytes, Web3Error>>
pub fn push( &mut self, call: CallRequest, block: Option<BlockId> ) -> impl Future<Output = Result<Bytes, Web3Error>>
Adds a call request to the current batch. The resulting future can only resolve after
the batch has been resolved via execute_all.
Explicitly returns a Future instead of being declared async so that we can split the
logic into a synchronous and asynchronous section and don’t want to capture &mut self
in the future.
Panics, if the batch is dropped before executing.
sourcepub async fn execute_all(self, batch_size: usize)
pub async fn execute_all(self, batch_size: usize)
Execute and resolve all enqueued CallRequests in a batched RPC call, chunk_size requests per roundtrip.
Top level request failures will be forwarded to the individual requests.
Auto Trait Implementations§
impl<T> Freeze for CallBatch<T>where
T: Freeze,
impl<T> !RefUnwindSafe for CallBatch<T>
impl<T> Send for CallBatch<T>where
T: Send,
impl<T> Sync for CallBatch<T>where
T: Sync,
impl<T> Unpin for CallBatch<T>where
T: Unpin,
impl<T> !UnwindSafe for CallBatch<T>
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