pub struct BatchOutcome<E> { /* private fields */ }Expand description
Final or partial outcome produced by one batch execution.
Create outcomes through BatchOutcomeBuilder::build so counters and
failure details are validated before the outcome exists.
use qubit_batch::{
BatchOutcome,
BatchOutcomeBuilder,
};
let outcome: BatchOutcome<&'static str> = BatchOutcomeBuilder::builder(2)
.completed_count(2)
.succeeded_count(2)
.build()
.expect("outcome counters should be consistent");
assert!(outcome.is_success());
assert_eq!(outcome.failure_count(), 0);use qubit_batch::{
BatchOutcome,
BatchOutcomeBuilder,
};
let builder = BatchOutcomeBuilder::<&'static str>::builder(1);
let _outcome = BatchOutcome::new(builder);Implementations§
Source§impl<E> BatchOutcome<E>
impl<E> BatchOutcome<E>
Sourcepub const fn task_count(&self) -> usize
pub const fn task_count(&self) -> usize
Returns the declared task count for this batch.
§Returns
The expected number of tasks supplied by the caller.
Sourcepub const fn completed_count(&self) -> usize
pub const fn completed_count(&self) -> usize
Sourcepub const fn succeeded_count(&self) -> usize
pub const fn succeeded_count(&self) -> usize
Sourcepub const fn failed_count(&self) -> usize
pub const fn failed_count(&self) -> usize
Sourcepub const fn panicked_count(&self) -> usize
pub const fn panicked_count(&self) -> usize
Sourcepub const fn failure_count(&self) -> usize
pub const fn failure_count(&self) -> usize
Sourcepub fn progress_counters(&self) -> ProgressCounters
pub fn progress_counters(&self) -> ProgressCounters
Builds generic progress counters from this outcome for terminal progress reporting.
§Returns
Counters with total set to Self::task_count, completed to
Self::completed_count, succeeded to Self::succeeded_count, and
failed to Self::failure_count (errors plus panics). Active count
stays zero because the batch has finished.
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 execution.
Sourcepub fn failures(&self) -> &[BatchTaskFailure<E>]
pub fn failures(&self) -> &[BatchTaskFailure<E>]
Returns the detailed failure records collected during execution.
§Returns
A shared slice of task failure records.
Sourcepub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Returns whether every task completed successfully.
§Returns
true if the batch has no failures and every declared task completed.
Sourcepub fn into_failures(self) -> Vec<BatchTaskFailure<E>>
pub fn into_failures(self) -> Vec<BatchTaskFailure<E>>
Consumes this outcome and returns its failure list.
§Returns
The detailed failure records collected during execution.
Trait Implementations§
Source§impl<E: Clone> Clone for BatchOutcome<E>
impl<E: Clone> Clone for BatchOutcome<E>
Source§fn clone(&self) -> BatchOutcome<E>
fn clone(&self) -> BatchOutcome<E>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<E: Debug> Debug for BatchOutcome<E>
impl<E: Debug> Debug for BatchOutcome<E>
Source§impl<E> Display for BatchOutcome<E>
impl<E> Display for BatchOutcome<E>
Source§impl<E: PartialEq> PartialEq for BatchOutcome<E>
impl<E: PartialEq> PartialEq for BatchOutcome<E>
Source§fn eq(&self, other: &BatchOutcome<E>) -> bool
fn eq(&self, other: &BatchOutcome<E>) -> bool
self and other values to be equal, and is used by ==.