pub struct BatchProcessResult { /* private fields */ }Expand description
Structured result produced by a batch processor.
The result distinguishes completed input items from successfully processed items because some processors can report a success count, such as affected database rows, that differs from the number of input items whose chunk returned.
use std::time::Duration;
use qubit_batch::BatchProcessResultBuilder;
let result = BatchProcessResultBuilder::builder(3)
.completed_count(3)
.processed_count(3)
.chunk_count(1)
.elapsed(Duration::ZERO)
.build()
.expect("process result counters should be consistent");
assert!(result.is_success());
assert_eq!(result.item_count(), 3);
assert_eq!(result.chunk_count(), 1);Implementations§
Source§impl BatchProcessResult
impl BatchProcessResult
Sourcepub const fn builder(item_count: usize) -> BatchProcessResultBuilder
pub const fn builder(item_count: usize) -> BatchProcessResultBuilder
Sourcepub const fn item_count(&self) -> usize
pub const fn item_count(&self) -> usize
Sourcepub const fn completed_count(&self) -> usize
pub const fn completed_count(&self) -> usize
Returns how many input items reached a terminal outcome.
§Returns
The number of completed input items.
Sourcepub const fn processed_count(&self) -> usize
pub const fn processed_count(&self) -> usize
Returns how many items were reported as successfully processed.
§Returns
The processor-reported success count.
Sourcepub const fn chunk_count(&self) -> usize
pub const fn chunk_count(&self) -> usize
Sourcepub const fn elapsed(&self) -> Duration
pub const fn elapsed(&self) -> Duration
Returns the total monotonic elapsed duration.
§Returns
The elapsed duration for this batch processing attempt.
Sourcepub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Returns whether all declared items were processed successfully.
§Returns
true when every declared item completed and was reported as processed.
Trait Implementations§
Source§impl Clone for BatchProcessResult
impl Clone for BatchProcessResult
Source§fn clone(&self) -> BatchProcessResult
fn clone(&self) -> BatchProcessResult
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 BatchProcessResult
impl Debug for BatchProcessResult
Source§impl Display for BatchProcessResult
impl Display for BatchProcessResult
Source§impl PartialEq for BatchProcessResult
impl PartialEq for BatchProcessResult
Source§fn eq(&self, other: &BatchProcessResult) -> bool
fn eq(&self, other: &BatchProcessResult) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for BatchProcessResult
impl StructuralPartialEq for BatchProcessResult
Auto Trait Implementations§
impl Freeze for BatchProcessResult
impl RefUnwindSafe for BatchProcessResult
impl Send for BatchProcessResult
impl Sync for BatchProcessResult
impl Unpin for BatchProcessResult
impl UnsafeUnpin for BatchProcessResult
impl UnwindSafe for BatchProcessResult
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