public static IFailableResult <TNewResult, TFailure> OnSuccess <TResult, TFailure, TNewResult>( this IFailableResult <TResult, TFailure> result, Func <TResult, IFailableResult <TNewResult, TFailure> > onSuccess ) => result.Handle( s => onSuccess(s), f => FailureResult <TNewResult, TFailure> .Create(f));
public static Task <IFailableResult <TResult, TNewFailure> > OnFailureAsync <TResult, TFailure, TNewFailure>( this IFailableResult <TResult, TFailure> result, Func <TFailure, Task <IFailableResult <TResult, TNewFailure> > > onFailureAsync ) => result.Handle( s => SuccessResult <TResult, TNewFailure> .CreateAsync(s), f => onFailureAsync(f));
public static Task <IFailableResult <TNewResult, TFailure> > OnSuccessAsync <TResult, TFailure, TNewResult>( this IFailableResult <TResult, TFailure> result, Func <TResult, Task <IFailableResult <TNewResult, TFailure> > > onSuccessAsync ) => result.Handle( onSuccessAsync, f => FailureResult <TNewResult, TFailure> .CreateAsync(f));
public static TResult GetResultOrThrowException <TResult, TFailure>( this IFailableResult <TResult, TFailure> result, Func <TFailure, Exception> onFailure ) => result.Handle( s => s, f => throw onFailure(f));
public static IFailableResult <TResult, TNewFailure> OnFailure <TResult, TFailure, TNewFailure>( this IFailableResult <TResult, TFailure> result, Func <TFailure, IFailableResult <TResult, TNewFailure> > onFailure ) => result.Handle( s => SuccessResult <TResult, TNewFailure> .Create(s), f => onFailure(f));
public static Task <IFailableResult <TNewResult, TFailure> > OnSuccessAsync <TResult, TFailure, TNewResult>( this IFailableResult <TResult, TFailure> result, Func <TResult, Task <TNewResult> > onSuccess, bool configureAwait = false ) => result.Handle( async s => SuccessResult <TNewResult, TFailure> .Create(await onSuccess(s).ConfigureAwait(configureAwait)), FailureResult <TNewResult, TFailure> .CreateAsync);
public static Task <IFailableResult <TResult, TNewFailure> > OnFailureAsync <TResult, TFailure, TNewFailure>( this IFailableResult <TResult, TFailure> result, Func <TFailure, Task <TNewFailure> > onFailureAsync, bool configureAwait = false ) => result.Handle( s => SuccessResult <TResult, TNewFailure> .CreateAsync(s), async f => FailureResult <TResult, TNewFailure> .Create(await onFailureAsync(f).ConfigureAwait(configureAwait)));