Struct jsonrpsee_core::client::BatchResponse
source · pub struct BatchResponse<'a, R> { /* private fields */ }
Available on crate feature
client
only.Expand description
Batch response.
Implementations§
source§impl<'a, R: Debug + 'a> BatchResponse<'a, R>
impl<'a, R: Debug + 'a> BatchResponse<'a, R>
sourcepub fn new(
successful_calls: usize,
responses: Vec<BatchEntry<'a, R>>,
failed_calls: usize
) -> Self
pub fn new( successful_calls: usize, responses: Vec<BatchEntry<'a, R>>, failed_calls: usize ) -> Self
Create a new BatchResponse
.
sourcepub fn num_successful_calls(&self) -> usize
pub fn num_successful_calls(&self) -> usize
Get the number of successful calls in the batch.
sourcepub fn num_failed_calls(&self) -> usize
pub fn num_failed_calls(&self) -> usize
Get the number of failed calls in the batch.
sourcepub fn into_ok(
self
) -> Result<impl Iterator<Item = R> + 'a + Debug, impl Iterator<Item = ErrorObject<'a>> + Debug>
pub fn into_ok( self ) -> Result<impl Iterator<Item = R> + 'a + Debug, impl Iterator<Item = ErrorObject<'a>> + Debug>
Returns Ok(iterator)
if all responses were successful
otherwise Err(iterator)
is returned.
If you want get all responses if an error responses occurs use BatchResponse::into_iter
instead where it’s possible to implement customized logic.
sourcepub fn ok(
&self
) -> Result<impl Iterator<Item = &R> + Debug, impl Iterator<Item = &ErrorObject<'a>> + Debug>
pub fn ok( &self ) -> Result<impl Iterator<Item = &R> + Debug, impl Iterator<Item = &ErrorObject<'a>> + Debug>
Similar to BatchResponse::into_ok
but takes the responses by reference instead.
sourcepub fn iter(&self) -> impl Iterator<Item = &BatchEntry<'_, R>>
pub fn iter(&self) -> impl Iterator<Item = &BatchEntry<'_, R>>
Returns an iterator over all responses.
Trait Implementations§
source§impl<'a, R: Clone> Clone for BatchResponse<'a, R>
impl<'a, R: Clone> Clone for BatchResponse<'a, R>
source§fn clone(&self) -> BatchResponse<'a, R>
fn clone(&self) -> BatchResponse<'a, R>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a, R: Debug> Debug for BatchResponse<'a, R>
impl<'a, R: Debug> Debug for BatchResponse<'a, R>
source§impl<'a, R> IntoIterator for BatchResponse<'a, R>
impl<'a, R> IntoIterator for BatchResponse<'a, R>
Auto Trait Implementations§
impl<'a, R> RefUnwindSafe for BatchResponse<'a, R>where R: RefUnwindSafe,
impl<'a, R> Send for BatchResponse<'a, R>where R: Send,
impl<'a, R> Sync for BatchResponse<'a, R>where R: Sync,
impl<'a, R> Unpin for BatchResponse<'a, R>where R: Unpin,
impl<'a, R> UnwindSafe for BatchResponse<'a, R>where R: UnwindSafe,
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