Skip to main content

Phases

Struct Phases 

Source
pub struct Phases<'a> { /* private fields */ }
Expand description

A fixed set of owned phases, selected by index rather than automatic sequence. A failed attempt leaves other phases available. The library decides whether to recover, retry, or propagate its error. Hand the final result to complete to resolve untouched phases; Drop without that handoff records abandonment.

Implementations§

Source§

impl<'a> Phases<'a>

Source

pub fn new( parent: &'a dyn Pulse, execution: Execution, parts: &[PhaseSpec<'_>], ) -> Self

Declare a fixed plan. Rejected plans retain cancellation via untracked children.

Source

pub fn run<T, E>( &mut self, index: usize, work: impl FnOnce(&dyn Pulse) -> Result<T, E>, ) -> Result<T, E>
where E: AsStopReason,

Run one phase at most once. A missing/repeated index is diagnosed and still runs the work through a cancellation-only view.

Source

pub fn run_classified<T, E>( &mut self, index: usize, is_stop: impl FnOnce(&E) -> bool, work: impl FnOnce(&dyn Pulse) -> Result<T, E>, ) -> Result<T, E>

Run with an explicit classifier when the error type cannot implement the borrowed conversion. The original result is returned unchanged.

Source

pub fn skip(&mut self, index: usize)

Explicitly discharge a phase which is unnecessary.

Trait Implementations§

Source§

impl Complete for Phases<'_>

Source§

fn complete_as(self, outcome: Outcome)

Record an explicitly chosen outcome, resolving unfinished observations. Join workers before calling this. Started but uncompleted children are abandoned; untouched children are skipped on success, not run on error.
Source§

fn complete<T, E>(self, result: Result<T, E>) -> Result<T, E>
where E: AsStopReason,

Classify the error with AsStopReason, record completion, and return the original result. Read more
Source§

fn complete_classified<T, E>( self, result: Result<T, E>, is_stop: impl FnOnce(&E) -> bool, ) -> Result<T, E>

Complete with an explicit classifier, for a foreign error type that Rust’s orphan rules keep from implementing AsStopReason.
Source§

fn complete_with<T, E>( self, body: impl FnOnce(&mut Self) -> Result<T, E>, ) -> Result<T, E>
where E: AsStopReason,

Run a multi-step body with this owner, then complete the owner with the body’s result and return that result unchanged. Read more
Source§

fn complete_with_classified<T, E>( self, is_stop: impl FnOnce(&E) -> bool, body: impl FnOnce(&mut Self) -> Result<T, E>, ) -> Result<T, E>

complete_with with an explicit classifier, for a foreign error type that cannot implement AsStopReason, such as an error wrapped with its source location.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Phases<'a>

§

impl<'a> !UnwindSafe for Phases<'a>

§

impl<'a> Freeze for Phases<'a>

§

impl<'a> Send for Phases<'a>

§

impl<'a> Sync for Phases<'a>

§

impl<'a> Unpin for Phases<'a>

§

impl<'a> UnsafeUnpin for Phases<'a>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.