public static async Task <TResult> HandleEntryPhase <TResult>( PhaseMethod <TResult> logic) where TResult : notnull { while (true) { if (await logic.Invoke() is Finished <TResult> finished) { return(finished.Value); } } }
public static async Task <IPhaseResult <TResult> > HandlePhase <TResult>( PhaseMethod <TResult> logic) { while (true) { switch (await logic.Invoke()) { case Finished <TResult> finished: return(finished); case Cancelled <TResult> : return(PhaseResult.NeedsRetry <TResult>()); } } }