Skip to main content

BatchExecutionState

Struct BatchExecutionState 

Source
pub struct BatchExecutionState<E> { /* private fields */ }
Expand description

Shared state collected while a batch executor is running.

Implementations§

Source§

impl<E> BatchExecutionState<E>

Source

pub const fn new(task_count: usize) -> Self

Creates empty execution state for a declared task count.

§Parameters
  • task_count - Declared number of tasks in the batch.
§Returns

Empty execution state.

Source

pub fn record_task_observed(&self) -> usize

Records one observed task.

§Returns

The observed task count after this task was recorded.

Source

pub fn record_task_started(&self)

Records that one task has started.

Source

pub fn record_task_succeeded(&self)

Records one successful task completion.

§Panics

Panics if no active task was recorded for this completion.

Source

pub fn record_task_failed(&self, index: usize, error: E)

Records one task error.

§Parameters
  • index - Zero-based task index.
  • error - Task error returned by the task.
§Panics

Panics if no active task was recorded for this completion.

Source

pub fn record_task_panicked(&self, index: usize, error: BatchTaskError<E>)

Records one task panic.

§Parameters
  • index - Zero-based task index.
  • error - Captured task panic.
§Panics

Panics if no active task was recorded for this completion.

Source

pub fn progress_counters(&self) -> ProgressCounters

Returns generic progress counters for this execution state.

§Returns

Counters suitable for progress reporting.

Source

pub fn into_outcome(self, elapsed: Duration) -> BatchOutcome<E>

Consumes this state and builds a batch outcome.

§Parameters
  • elapsed - Monotonic elapsed duration.
§Returns

The final or partial outcome represented by this state.

Auto Trait Implementations§

§

impl<E> !Freeze for BatchExecutionState<E>

§

impl<E> RefUnwindSafe for BatchExecutionState<E>

§

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

§

impl<E> Sync for BatchExecutionState<E>
where E: Send,

§

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

§

impl<E> UnsafeUnpin for BatchExecutionState<E>

§

impl<E> UnwindSafe for BatchExecutionState<E>

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> 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, 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.