pub struct BatchProcessResultBuilder { /* private fields */ }Expand description
Builder carrying validated parts for a crate::BatchProcessResult.
The builder checks that completed, processed, and chunk counters describe a consistent processing result before creating the result.
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.chunk_count(), 1);Implementations§
Source§impl BatchProcessResultBuilder
impl BatchProcessResultBuilder
Sourcepub const fn completed_count(self, completed_count: usize) -> Self
pub const fn completed_count(self, completed_count: usize) -> Self
Sourcepub const fn processed_count(self, processed_count: usize) -> Self
pub const fn processed_count(self, processed_count: usize) -> Self
Sourcepub const fn chunk_count(self, chunk_count: usize) -> Self
pub const fn chunk_count(self, chunk_count: usize) -> Self
Sourcepub fn validate(self) -> Result<Self, BatchProcessResultBuildError>
pub fn validate(self) -> Result<Self, BatchProcessResultBuildError>
Validates this builder.
§Returns
Ok(builder) when all counters are consistent.
§Errors
Returns BatchProcessResultBuildError when the counters are
inconsistent.
Sourcepub fn build(self) -> Result<BatchProcessResult, BatchProcessResultBuildError>
pub fn build(self) -> Result<BatchProcessResult, BatchProcessResultBuildError>
Validates this builder and creates a batch process result.
§Returns
Ok(result) when all counters are consistent.
§Errors
Returns BatchProcessResultBuildError when the counters are
inconsistent.
Trait Implementations§
Source§impl Clone for BatchProcessResultBuilder
impl Clone for BatchProcessResultBuilder
Source§fn clone(&self) -> BatchProcessResultBuilder
fn clone(&self) -> BatchProcessResultBuilder
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 BatchProcessResultBuilder
impl Debug for BatchProcessResultBuilder
Source§impl PartialEq for BatchProcessResultBuilder
impl PartialEq for BatchProcessResultBuilder
Source§fn eq(&self, other: &BatchProcessResultBuilder) -> bool
fn eq(&self, other: &BatchProcessResultBuilder) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for BatchProcessResultBuilder
impl StructuralPartialEq for BatchProcessResultBuilder
Auto Trait Implementations§
impl Freeze for BatchProcessResultBuilder
impl RefUnwindSafe for BatchProcessResultBuilder
impl Send for BatchProcessResultBuilder
impl Sync for BatchProcessResultBuilder
impl Unpin for BatchProcessResultBuilder
impl UnsafeUnpin for BatchProcessResultBuilder
impl UnwindSafe for BatchProcessResultBuilder
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