pub struct ChunkedBatchProcessorBuilder<P> { /* private fields */ }Expand description
Builder for ChunkedBatchProcessor.
Use the builder when the default progress interval or reporter should be customized.
use std::{
num::NonZeroUsize,
time::Duration,
};
use qubit_batch::{
ChunkedBatchProcessor,
SequentialBatchProcessor,
};
let delegate = SequentialBatchProcessor::new(|_item: &i32| {});
let processor = ChunkedBatchProcessor::builder(
delegate,
NonZeroUsize::new(2).expect("chunk size should be non-zero"),
)
.report_interval(Duration::ZERO)
.build();
assert_eq!(processor.chunk_size().get(), 2);
assert_eq!(processor.report_interval(), Duration::ZERO);Implementations§
Source§impl<P> ChunkedBatchProcessorBuilder<P>
impl<P> ChunkedBatchProcessorBuilder<P>
Sourcepub fn new(delegate: P, chunk_size: NonZeroUsize) -> Self
pub fn new(delegate: P, chunk_size: NonZeroUsize) -> Self
Sourcepub const fn report_interval(self, report_interval: Duration) -> Self
pub const fn report_interval(self, report_interval: Duration) -> Self
Sets the progress-report interval.
§Parameters
report_interval- Minimum time between due-based running progress callbacks.Duration::ZEROreports at every completed-chunk progress point.
§Returns
This builder for fluent configuration.
Sourcepub fn reporter<R>(self, reporter: R) -> Selfwhere
R: ProgressReporter + 'static,
pub fn reporter<R>(self, reporter: R) -> Selfwhere
R: ProgressReporter + 'static,
Sourcepub fn reporter_arc(self, reporter: Arc<dyn ProgressReporter>) -> Self
pub fn reporter_arc(self, reporter: Arc<dyn ProgressReporter>) -> Self
Sourcepub fn no_reporter(self) -> Self
pub fn no_reporter(self) -> Self
Disables progress callbacks by using NoOpProgressReporter.
§Returns
This builder for fluent configuration.
Sourcepub fn build(self) -> ChunkedBatchProcessor<P>
pub fn build(self) -> ChunkedBatchProcessor<P>
Builds a ChunkedBatchProcessor.
§Returns
A chunked batch processor with this builder’s configuration.
Auto Trait Implementations§
impl<P> Freeze for ChunkedBatchProcessorBuilder<P>where
P: Freeze,
impl<P> !RefUnwindSafe for ChunkedBatchProcessorBuilder<P>
impl<P> Send for ChunkedBatchProcessorBuilder<P>where
P: Send,
impl<P> Sync for ChunkedBatchProcessorBuilder<P>where
P: Sync,
impl<P> Unpin for ChunkedBatchProcessorBuilder<P>where
P: Unpin,
impl<P> UnsafeUnpin for ChunkedBatchProcessorBuilder<P>where
P: UnsafeUnpin,
impl<P> !UnwindSafe for ChunkedBatchProcessorBuilder<P>
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