pub struct FlowContext<'a> { /* private fields */ }Expand description
Records calls and latches failures while application code controls sequencing.
Implementations§
Source§impl<'a> FlowContext<'a>
impl<'a> FlowContext<'a>
Sourcepub async fn ask(
&mut self,
state: &State,
operators: &[NamedQuestion],
) -> Result<FlowAnswers, FlowExit>
pub async fn ask( &mut self, state: &State, operators: &[NamedQuestion], ) -> Result<FlowAnswers, FlowExit>
Ask independent operators together about one state.
§Errors
Returns FlowExit::Error for an empty batch, duplicate operator names,
a previously latched failure, or request/provider/response validation
failures. Successful undecided answers remain available for inspection.
Sourcepub async fn ask_request(
&mut self,
request: &Request,
) -> Result<FlowAnswers, FlowExit>
pub async fn ask_request( &mut self, request: &Request, ) -> Result<FlowAnswers, FlowExit>
Ask a request that may carry image assets.
§Errors
Returns FlowExit::Error for a previously latched failure or any error
from the checked provider call. A new call failure is retained in the
trace and latched so later calls cannot silently proceed.
Dropping this future after it starts retains the attempt and latches
ErrorKind::Runtime for interrupted local execution. This does not
establish whether remote work stopped or incurred charges. An unpolled
future records no attempt.
Sourcepub fn finish<T>(
self,
result: Result<T, FlowExit>,
) -> Result<FlowOutcome<T>, FlowFailure>
pub fn finish<T>( self, result: Result<T, FlowExit>, ) -> Result<FlowOutcome<T>, FlowFailure>
Finish. A caught provider error cannot become successful completion.
§Errors
Returns FlowFailure with the trace when an earlier call failed,
a polled request future was dropped before completing, or
result contains FlowExit::Error. An uncertainty exit instead becomes
a successful FlowOutcome with stopped_at set.