Skip to main content

BatchOutcome

Struct BatchOutcome 

Source
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>

Source

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.

Source

pub const fn completed_count(&self) -> usize

Returns how many tasks reached a terminal outcome.

§Returns

The number of completed tasks.

Source

pub const fn succeeded_count(&self) -> usize

Returns how many tasks completed successfully.

§Returns

The number of successful tasks.

Source

pub const fn failed_count(&self) -> usize

Returns how many tasks returned their own error.

§Returns

The number of failed tasks.

Source

pub const fn panicked_count(&self) -> usize

Returns how many tasks panicked.

§Returns

The number of panicked tasks.

Source

pub const fn failure_count(&self) -> usize

Returns the total number of task failures.

§Returns

Failed plus panicked task count.

Source

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.

Source

pub const fn elapsed(&self) -> Duration

Returns the total monotonic elapsed duration.

§Returns

The elapsed duration for this batch execution.

Source

pub fn failures(&self) -> &[BatchTaskFailure<E>]

Returns the detailed failure records collected during execution.

§Returns

A shared slice of task failure records.

Source

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.

Source

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>

Source§

fn clone(&self) -> BatchOutcome<E>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug> Debug for BatchOutcome<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E> Display for BatchOutcome<E>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats a concise summary of this batch outcome.

§Parameters
  • formatter - Formatter receiving the summary text.
§Returns

The formatting result.

Source§

impl<E: PartialEq> PartialEq for BatchOutcome<E>

Source§

fn eq(&self, other: &BatchOutcome<E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: Eq> Eq for BatchOutcome<E>

Source§

impl<E> StructuralPartialEq for BatchOutcome<E>

Auto Trait Implementations§

§

impl<E> Freeze for BatchOutcome<E>

§

impl<E> RefUnwindSafe for BatchOutcome<E>
where E: RefUnwindSafe,

§

impl<E> Send for BatchOutcome<E>
where E: Send,

§

impl<E> Sync for BatchOutcome<E>
where E: Sync,

§

impl<E> Unpin for BatchOutcome<E>
where E: Unpin,

§

impl<E> UnsafeUnpin for BatchOutcome<E>

§

impl<E> UnwindSafe for BatchOutcome<E>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.