pub enum BatchProcessError {
CountShortfall {
expected: usize,
actual: usize,
result: BatchProcessResult,
},
CountExceeded {
expected: usize,
observed_at_least: usize,
result: BatchProcessResult,
},
}Expand description
Error returned by built-in consumer-backed batch processors.
The error variants report mismatches between the declared item count and the number of items yielded by the input source. Each variant carries the partial result accumulated before the mismatch was detected.
use qubit_batch::{
BatchProcessError,
BatchProcessor,
SequentialBatchProcessor,
};
let mut processor = SequentialBatchProcessor::new(|_item: &i32| {});
let error = processor
.process_with_count([1], 2)
.expect_err("iterator should yield fewer items than declared");
match error {
BatchProcessError::CountShortfall { expected, actual, result } => {
assert_eq!(expected, 2);
assert_eq!(actual, 1);
assert_eq!(result.completed_count(), 1);
}
BatchProcessError::CountExceeded { .. } => unreachable!(),
}Variants§
CountShortfall
The input source ended before the declared item count was reached.
Fields
§
result: BatchProcessResultResult accumulated before the shortfall was reported.
CountExceeded
The input source yielded more items than the declared item count.
Implementations§
Source§impl BatchProcessError
impl BatchProcessError
Sourcepub const fn result(&self) -> &BatchProcessResult
pub const fn result(&self) -> &BatchProcessResult
Returns the partial result attached to this error.
§Returns
A shared reference to the partial batch process result.
Sourcepub fn into_result(self) -> BatchProcessResult
pub fn into_result(self) -> BatchProcessResult
Trait Implementations§
Source§impl Clone for BatchProcessError
impl Clone for BatchProcessError
Source§fn clone(&self) -> BatchProcessError
fn clone(&self) -> BatchProcessError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BatchProcessError
impl Debug for BatchProcessError
Source§impl Display for BatchProcessError
impl Display for BatchProcessError
Source§impl Error for BatchProcessError
impl Error for BatchProcessError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for BatchProcessError
impl PartialEq for BatchProcessError
Source§fn eq(&self, other: &BatchProcessError) -> bool
fn eq(&self, other: &BatchProcessError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for BatchProcessError
impl StructuralPartialEq for BatchProcessError
Auto Trait Implementations§
impl Freeze for BatchProcessError
impl RefUnwindSafe for BatchProcessError
impl Send for BatchProcessError
impl Sync for BatchProcessError
impl Unpin for BatchProcessError
impl UnsafeUnpin for BatchProcessError
impl UnwindSafe for BatchProcessError
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