Class ResultTErrorBindExtensions

Namespace
REslava.Result.Extensions
Assembly
REslava.Result.dll

Bind overloads for Result<TValue, TError> typed pipelines. Each overload grows the error union by one slot:

  • Overload 1 — merges two single-error Results: Result<TIn,T1> + Result<TOut,T2> → Result<TOut, ErrorsOf<T1,T2>>
  • Overloads 2–7 — grow an existing ErrorsOf union by one slot per step.
public static class ResultTErrorBindExtensions
Inheritance
ResultTErrorBindExtensions
Inherited Members

Methods

Bind<TIn, TOut, T1, T2, T3, T4, T5, T6, T7, T8>(Result<TIn, ErrorsOf<T1, T2, T3, T4, T5, T6, T7>>, Func<TIn, Result<TOut, T8>>)

Grows a 7-slot error union by one slot — maximum union size (T8).

public static Result<TOut, ErrorsOf<T1, T2, T3, T4, T5, T6, T7, T8>> Bind<TIn, TOut, T1, T2, T3, T4, T5, T6, T7, T8>(this Result<TIn, ErrorsOf<T1, T2, T3, T4, T5, T6, T7>> result, Func<TIn, Result<TOut, T8>> next) where T1 : IError where T2 : IError where T3 : IError where T4 : IError where T5 : IError where T6 : IError where T7 : IError where T8 : IError

Parameters

result Result<TIn, ErrorsOf<T1, T2, T3, T4, T5, T6, T7>>
next Func<TIn, Result<TOut, T8>>

Returns

Result<TOut, ErrorsOf<T1, T2, T3, T4, T5, T6, T7, T8>>

Type Parameters

TIn
TOut
T1
T2
T3
T4
T5
T6
T7
T8

Bind<TIn, TOut, T1, T2>(Result<TIn, T1>, Func<TIn, Result<TOut, T2>>)

Chains two single-error Results into a 2-slot error union. Use this as the first Bind in a typed pipeline.

public static Result<TOut, ErrorsOf<T1, T2>> Bind<TIn, TOut, T1, T2>(this Result<TIn, T1> result, Func<TIn, Result<TOut, T2>> next) where T1 : IError where T2 : IError

Parameters

result Result<TIn, T1>
next Func<TIn, Result<TOut, T2>>

Returns

Result<TOut, ErrorsOf<T1, T2>>

Type Parameters

TIn
TOut
T1
T2

Examples

// Steps declare single concrete errors
Result<Order, ValidationError> Validate(Req r) => ...
Result<Order, InventoryError>  Reserve(Order o)  => ...

// First Bind grows to ErrorsOf<ValidationError, InventoryError>
Validate(req).Bind(Reserve);

Bind<TIn, TOut, T1, T2, T3>(Result<TIn, ErrorsOf<T1, T2>>, Func<TIn, Result<TOut, T3>>)

Grows a 2-slot error union by one slot.

public static Result<TOut, ErrorsOf<T1, T2, T3>> Bind<TIn, TOut, T1, T2, T3>(this Result<TIn, ErrorsOf<T1, T2>> result, Func<TIn, Result<TOut, T3>> next) where T1 : IError where T2 : IError where T3 : IError

Parameters

result Result<TIn, ErrorsOf<T1, T2>>
next Func<TIn, Result<TOut, T3>>

Returns

Result<TOut, ErrorsOf<T1, T2, T3>>

Type Parameters

TIn
TOut
T1
T2
T3

Bind<TIn, TOut, T1, T2, T3, T4>(Result<TIn, ErrorsOf<T1, T2, T3>>, Func<TIn, Result<TOut, T4>>)

Grows a 3-slot error union by one slot.

public static Result<TOut, ErrorsOf<T1, T2, T3, T4>> Bind<TIn, TOut, T1, T2, T3, T4>(this Result<TIn, ErrorsOf<T1, T2, T3>> result, Func<TIn, Result<TOut, T4>> next) where T1 : IError where T2 : IError where T3 : IError where T4 : IError

Parameters

result Result<TIn, ErrorsOf<T1, T2, T3>>
next Func<TIn, Result<TOut, T4>>

Returns

Result<TOut, ErrorsOf<T1, T2, T3, T4>>

Type Parameters

TIn
TOut
T1
T2
T3
T4

Bind<TIn, TOut, T1, T2, T3, T4, T5>(Result<TIn, ErrorsOf<T1, T2, T3, T4>>, Func<TIn, Result<TOut, T5>>)

Grows a 4-slot error union by one slot.

public static Result<TOut, ErrorsOf<T1, T2, T3, T4, T5>> Bind<TIn, TOut, T1, T2, T3, T4, T5>(this Result<TIn, ErrorsOf<T1, T2, T3, T4>> result, Func<TIn, Result<TOut, T5>> next) where T1 : IError where T2 : IError where T3 : IError where T4 : IError where T5 : IError

Parameters

result Result<TIn, ErrorsOf<T1, T2, T3, T4>>
next Func<TIn, Result<TOut, T5>>

Returns

Result<TOut, ErrorsOf<T1, T2, T3, T4, T5>>

Type Parameters

TIn
TOut
T1
T2
T3
T4
T5

Bind<TIn, TOut, T1, T2, T3, T4, T5, T6>(Result<TIn, ErrorsOf<T1, T2, T3, T4, T5>>, Func<TIn, Result<TOut, T6>>)

Grows a 5-slot error union by one slot.

public static Result<TOut, ErrorsOf<T1, T2, T3, T4, T5, T6>> Bind<TIn, TOut, T1, T2, T3, T4, T5, T6>(this Result<TIn, ErrorsOf<T1, T2, T3, T4, T5>> result, Func<TIn, Result<TOut, T6>> next) where T1 : IError where T2 : IError where T3 : IError where T4 : IError where T5 : IError where T6 : IError

Parameters

result Result<TIn, ErrorsOf<T1, T2, T3, T4, T5>>
next Func<TIn, Result<TOut, T6>>

Returns

Result<TOut, ErrorsOf<T1, T2, T3, T4, T5, T6>>

Type Parameters

TIn
TOut
T1
T2
T3
T4
T5
T6

Bind<TIn, TOut, T1, T2, T3, T4, T5, T6, T7>(Result<TIn, ErrorsOf<T1, T2, T3, T4, T5, T6>>, Func<TIn, Result<TOut, T7>>)

Grows a 6-slot error union by one slot.

public static Result<TOut, ErrorsOf<T1, T2, T3, T4, T5, T6, T7>> Bind<TIn, TOut, T1, T2, T3, T4, T5, T6, T7>(this Result<TIn, ErrorsOf<T1, T2, T3, T4, T5, T6>> result, Func<TIn, Result<TOut, T7>> next) where T1 : IError where T2 : IError where T3 : IError where T4 : IError where T5 : IError where T6 : IError where T7 : IError

Parameters

result Result<TIn, ErrorsOf<T1, T2, T3, T4, T5, T6>>
next Func<TIn, Result<TOut, T7>>

Returns

Result<TOut, ErrorsOf<T1, T2, T3, T4, T5, T6, T7>>

Type Parameters

TIn
TOut
T1
T2
T3
T4
T5
T6
T7