public static IPhaseResult <TMapped> Map <TResult, TMapped>( this IPhaseResult <TResult> source, Func <TResult, TMapped> onFinalValue) { return(source switch { Finished <TResult> finished => onFinalValue(finished.Value).AsFinished(), Cancelled <TResult> => PhaseResult.NeedsRetry <TMapped>(), NeedsRetry <TResult> => PhaseResult.NeedsRetry <TMapped>(), _ => throw new Exception() });
public static PipeResult <TDone, TNotDone> FromPhaseResult <TDone, TNotDone>(this IPhaseResult phaseResult) => phaseResult switch {