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>
impl<'a> Phases<'a>
Sourcepub fn new(
parent: &'a dyn Pulse,
execution: Execution,
parts: &[PhaseSpec<'_>],
) -> Self
pub fn new( parent: &'a dyn Pulse, execution: Execution, parts: &[PhaseSpec<'_>], ) -> Self
Declare a fixed plan. Rejected plans retain cancellation via untracked children.
Sourcepub fn run<T, E>(
&mut self,
index: usize,
work: impl FnOnce(&dyn Pulse) -> Result<T, E>,
) -> Result<T, E>where
E: AsStopReason,
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.
Trait Implementations§
Source§impl Complete for Phases<'_>
impl Complete for Phases<'_>
Source§fn complete_as(self, outcome: Outcome)
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,
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 moreSource§fn complete_classified<T, E>(
self,
result: Result<T, E>,
is_stop: impl FnOnce(&E) -> bool,
) -> Result<T, E>
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,
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 moreSource§fn complete_with_classified<T, E>(
self,
is_stop: impl FnOnce(&E) -> bool,
body: impl FnOnce(&mut Self) -> Result<T, E>,
) -> Result<T, E>
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> 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