Struct jsonrpsee_core::client::BatchResponse
source · pub struct BatchResponse<'a, R> { /* private fields */ }
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 more