Table of Contents

Class BindExtensionsAsync

Namespace
FunctionalDdd
Assembly
FunctionalDdd.RailwayOrientedProgramming.dll

Provides asynchronous extension methods for binding (chaining) operations over Result values.

public static class BindExtensionsAsync
Inheritance
BindExtensionsAsync
Inherited Members

Methods

BindAsync<TValue, TResult>(Result<TValue>, Func<TValue, Task<Result<TResult>>>)

Asynchronously binds the result to a function that returns a new result.

public static Task<Result<TResult>> BindAsync<TValue, TResult>(this Result<TValue> result, Func<TValue, Task<Result<TResult>>> func)

Parameters

result Result<TValue>

The result to bind.

func Func<TValue, Task<Result<TResult>>>

The async function to call if the result is successful.

Returns

Task<Result<TResult>>

A new result from the function if success; otherwise the original failure.

Type Parameters

TValue

Type of the input result value.

TResult

Type of the output result value.

BindAsync<TValue, TResult>(Result<TValue>, Func<TValue, ValueTask<Result<TResult>>>)

Binds the result to an async function that returns a ValueTask result.

public static ValueTask<Result<TResult>> BindAsync<TValue, TResult>(this Result<TValue> result, Func<TValue, ValueTask<Result<TResult>>> valueTask)

Parameters

result Result<TValue>

The result to bind.

valueTask Func<TValue, ValueTask<Result<TResult>>>

The async function to call if the result is successful.

Returns

ValueTask<Result<TResult>>

A new result from the function if success; otherwise the original failure.

Type Parameters

TValue

Type of the input result value.

TResult

Type of the output result value.

BindAsync<TValue, TResult>(Task<Result<TValue>>, Func<TValue, Result<TResult>>)

Asynchronously binds a task result to a synchronous function that returns a new result.

public static Task<Result<TResult>> BindAsync<TValue, TResult>(this Task<Result<TValue>> resultTask, Func<TValue, Result<TResult>> func)

Parameters

resultTask Task<Result<TValue>>

The task containing the result to bind.

func Func<TValue, Result<TResult>>

The function to call if the result is successful.

Returns

Task<Result<TResult>>

A new result from the function if success; otherwise the original failure.

Type Parameters

TValue

Type of the input result value.

TResult

Type of the output result value.

BindAsync<TValue, TResult>(Task<Result<TValue>>, Func<TValue, Task<Result<TResult>>>)

Asynchronously binds a task result to a function that returns a new result.

public static Task<Result<TResult>> BindAsync<TValue, TResult>(this Task<Result<TValue>> resultTask, Func<TValue, Task<Result<TResult>>> func)

Parameters

resultTask Task<Result<TValue>>

The task containing the result to bind.

func Func<TValue, Task<Result<TResult>>>

The async function to call if the result is successful.

Returns

Task<Result<TResult>>

A new result from the function if success; otherwise the original failure.

Type Parameters

TValue

Type of the input result value.

TResult

Type of the output result value.

BindAsync<TValue, TResult>(ValueTask<Result<TValue>>, Func<TValue, Result<TResult>>)

Asynchronously binds a ValueTask result to a synchronous function that returns a new result.

public static ValueTask<Result<TResult>> BindAsync<TValue, TResult>(this ValueTask<Result<TValue>> resultTask, Func<TValue, Result<TResult>> func)

Parameters

resultTask ValueTask<Result<TValue>>

The ValueTask containing the result to bind.

func Func<TValue, Result<TResult>>

The function to call if the result is successful.

Returns

ValueTask<Result<TResult>>

A new result from the function if success; otherwise the original failure.

Type Parameters

TValue

Type of the input result value.

TResult

Type of the output result value.

BindAsync<TValue, TResult>(ValueTask<Result<TValue>>, Func<TValue, ValueTask<Result<TResult>>>)

Asynchronously binds a ValueTask result to a function that returns a new result.

public static ValueTask<Result<TResult>> BindAsync<TValue, TResult>(this ValueTask<Result<TValue>> resultTask, Func<TValue, ValueTask<Result<TResult>>> valueTask)

Parameters

resultTask ValueTask<Result<TValue>>

The ValueTask containing the result to bind.

valueTask Func<TValue, ValueTask<Result<TResult>>>

The async function to call if the result is successful.

Returns

ValueTask<Result<TResult>>

A new result from the function if success; otherwise the original failure.

Type Parameters

TValue

Type of the input result value.

TResult

Type of the output result value.