Table of Contents

Class CheckIfExtensionsAsync

Namespace
Trellis
Assembly
Trellis.Results.dll

Async CheckIf extensions where BOTH input and check function are async (Task).

public static class CheckIfExtensionsAsync
Inheritance
CheckIfExtensionsAsync
Inherited Members

Methods

CheckIfAsync<T>(Task<Result<T>>, bool, Func<T, Task<Result<Unit>>>)

Conditionally runs an async validation function when the boolean condition is true. Both the input and the check function are async.

public static Task<Result<T>> CheckIfAsync<T>(this Task<Result<T>> resultTask, bool condition, Func<T, Task<Result<Unit>>> func)

Parameters

resultTask Task<Result<T>>

The task containing the result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, Task<Result<Unit>>>

The async validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(Task<Result<T>>, bool, Func<T, Result<Unit>>)

Conditionally runs a sync validation function when the boolean condition is true. Only the input is async; the check function is sync.

public static Task<Result<T>> CheckIfAsync<T>(this Task<Result<T>> resultTask, bool condition, Func<T, Result<Unit>> func)

Parameters

resultTask Task<Result<T>>

The task containing the result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, Result<Unit>>

The sync validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(Task<Result<T>>, Func<T, bool>, Func<T, Task<Result<Unit>>>)

Conditionally runs an async validation function when the predicate returns true. Both the input and the check function are async.

public static Task<Result<T>> CheckIfAsync<T>(this Task<Result<T>> resultTask, Func<T, bool> predicate, Func<T, Task<Result<Unit>>> func)

Parameters

resultTask Task<Result<T>>

The task containing the result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, Task<Result<Unit>>>

The async validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(Task<Result<T>>, Func<T, bool>, Func<T, Result<Unit>>)

Conditionally runs a sync validation function when the predicate returns true. Only the input is async; the check function is sync.

public static Task<Result<T>> CheckIfAsync<T>(this Task<Result<T>> resultTask, Func<T, bool> predicate, Func<T, Result<Unit>> func)

Parameters

resultTask Task<Result<T>>

The task containing the result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, Result<Unit>>

The sync validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(ValueTask<Result<T>>, bool, Func<T, ValueTask<Result<Unit>>>)

Conditionally runs an async validation function when the boolean condition is true. Both the input and the check function are async (ValueTask).

public static ValueTask<Result<T>> CheckIfAsync<T>(this ValueTask<Result<T>> resultTask, bool condition, Func<T, ValueTask<Result<Unit>>> func)

Parameters

resultTask ValueTask<Result<T>>

The async result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, ValueTask<Result<Unit>>>

The async validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(ValueTask<Result<T>>, bool, Func<T, Result<Unit>>)

Conditionally runs a sync validation function when the boolean condition is true. Only the input is async (ValueTask); the check function is sync.

public static ValueTask<Result<T>> CheckIfAsync<T>(this ValueTask<Result<T>> resultTask, bool condition, Func<T, Result<Unit>> func)

Parameters

resultTask ValueTask<Result<T>>

The async result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, Result<Unit>>

The sync validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(ValueTask<Result<T>>, Func<T, bool>, Func<T, ValueTask<Result<Unit>>>)

Conditionally runs an async validation function when the predicate returns true. Both the input and the check function are async (ValueTask).

public static ValueTask<Result<T>> CheckIfAsync<T>(this ValueTask<Result<T>> resultTask, Func<T, bool> predicate, Func<T, ValueTask<Result<Unit>>> func)

Parameters

resultTask ValueTask<Result<T>>

The async result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, ValueTask<Result<Unit>>>

The async validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(ValueTask<Result<T>>, Func<T, bool>, Func<T, Result<Unit>>)

Conditionally runs a sync validation function when the predicate returns true. Only the input is async (ValueTask); the check function is sync.

public static ValueTask<Result<T>> CheckIfAsync<T>(this ValueTask<Result<T>> resultTask, Func<T, bool> predicate, Func<T, Result<Unit>> func)

Parameters

resultTask ValueTask<Result<T>>

The async result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, Result<Unit>>

The sync validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(Result<T>, bool, Func<T, Task<Result<Unit>>>)

Conditionally runs an async validation function when the boolean condition is true. Only the check function is async; the input is sync.

public static Task<Result<T>> CheckIfAsync<T>(this Result<T> result, bool condition, Func<T, Task<Result<Unit>>> func)

Parameters

result Result<T>

The result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, Task<Result<Unit>>>

The async validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(Result<T>, bool, Func<T, ValueTask<Result<Unit>>>)

Conditionally runs an async validation function when the boolean condition is true. Only the check function is async (ValueTask); the input is sync.

public static ValueTask<Result<T>> CheckIfAsync<T>(this Result<T> result, bool condition, Func<T, ValueTask<Result<Unit>>> func)

Parameters

result Result<T>

The result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, ValueTask<Result<Unit>>>

The async validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(Result<T>, Func<T, bool>, Func<T, Task<Result<Unit>>>)

Conditionally runs an async validation function when the predicate returns true. Only the check function is async; the input is sync.

public static Task<Result<T>> CheckIfAsync<T>(this Result<T> result, Func<T, bool> predicate, Func<T, Task<Result<Unit>>> func)

Parameters

result Result<T>

The result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, Task<Result<Unit>>>

The async validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T>(Result<T>, Func<T, bool>, Func<T, ValueTask<Result<Unit>>>)

Conditionally runs an async validation function when the predicate returns true. Only the check function is async (ValueTask); the input is sync.

public static ValueTask<Result<T>> CheckIfAsync<T>(this Result<T> result, Func<T, bool> predicate, Func<T, ValueTask<Result<Unit>>> func)

Parameters

result Result<T>

The result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, ValueTask<Result<Unit>>>

The async validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

CheckIfAsync<T, TK>(Task<Result<T>>, bool, Func<T, Task<Result<TK>>>)

Conditionally runs an async validation function when the boolean condition is true. Both the input and the check function are async.

public static Task<Result<T>> CheckIfAsync<T, TK>(this Task<Result<T>> resultTask, bool condition, Func<T, Task<Result<TK>>> func)

Parameters

resultTask Task<Result<T>>

The task containing the result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, Task<Result<TK>>>

The async validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(Task<Result<T>>, bool, Func<T, Result<TK>>)

Conditionally runs a sync validation function when the boolean condition is true. Only the input is async; the check function is sync.

public static Task<Result<T>> CheckIfAsync<T, TK>(this Task<Result<T>> resultTask, bool condition, Func<T, Result<TK>> func)

Parameters

resultTask Task<Result<T>>

The task containing the result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, Result<TK>>

The sync validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(Task<Result<T>>, Func<T, bool>, Func<T, Task<Result<TK>>>)

Conditionally runs an async validation function when the predicate returns true. Both the input and the check function are async.

public static Task<Result<T>> CheckIfAsync<T, TK>(this Task<Result<T>> resultTask, Func<T, bool> predicate, Func<T, Task<Result<TK>>> func)

Parameters

resultTask Task<Result<T>>

The task containing the result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, Task<Result<TK>>>

The async validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(Task<Result<T>>, Func<T, bool>, Func<T, Result<TK>>)

Conditionally runs a sync validation function when the predicate returns true. Only the input is async; the check function is sync.

public static Task<Result<T>> CheckIfAsync<T, TK>(this Task<Result<T>> resultTask, Func<T, bool> predicate, Func<T, Result<TK>> func)

Parameters

resultTask Task<Result<T>>

The task containing the result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, Result<TK>>

The sync validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(ValueTask<Result<T>>, bool, Func<T, ValueTask<Result<TK>>>)

Conditionally runs an async validation function when the boolean condition is true. Both the input and the check function are async (ValueTask).

public static ValueTask<Result<T>> CheckIfAsync<T, TK>(this ValueTask<Result<T>> resultTask, bool condition, Func<T, ValueTask<Result<TK>>> func)

Parameters

resultTask ValueTask<Result<T>>

The async result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, ValueTask<Result<TK>>>

The async validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(ValueTask<Result<T>>, bool, Func<T, Result<TK>>)

Conditionally runs a sync validation function when the boolean condition is true. Only the input is async (ValueTask); the check function is sync.

public static ValueTask<Result<T>> CheckIfAsync<T, TK>(this ValueTask<Result<T>> resultTask, bool condition, Func<T, Result<TK>> func)

Parameters

resultTask ValueTask<Result<T>>

The async result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, Result<TK>>

The sync validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(ValueTask<Result<T>>, Func<T, bool>, Func<T, ValueTask<Result<TK>>>)

Conditionally runs an async validation function when the predicate returns true. Both the input and the check function are async (ValueTask).

public static ValueTask<Result<T>> CheckIfAsync<T, TK>(this ValueTask<Result<T>> resultTask, Func<T, bool> predicate, Func<T, ValueTask<Result<TK>>> func)

Parameters

resultTask ValueTask<Result<T>>

The async result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, ValueTask<Result<TK>>>

The async validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(ValueTask<Result<T>>, Func<T, bool>, Func<T, Result<TK>>)

Conditionally runs a sync validation function when the predicate returns true. Only the input is async (ValueTask); the check function is sync.

public static ValueTask<Result<T>> CheckIfAsync<T, TK>(this ValueTask<Result<T>> resultTask, Func<T, bool> predicate, Func<T, Result<TK>> func)

Parameters

resultTask ValueTask<Result<T>>

The async result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, Result<TK>>

The sync validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(Result<T>, bool, Func<T, Task<Result<TK>>>)

Conditionally runs an async validation function when the boolean condition is true. Only the check function is async; the input is sync.

public static Task<Result<T>> CheckIfAsync<T, TK>(this Result<T> result, bool condition, Func<T, Task<Result<TK>>> func)

Parameters

result Result<T>

The result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, Task<Result<TK>>>

The async validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(Result<T>, bool, Func<T, ValueTask<Result<TK>>>)

Conditionally runs an async validation function when the boolean condition is true. Only the check function is async (ValueTask); the input is sync.

public static ValueTask<Result<T>> CheckIfAsync<T, TK>(this Result<T> result, bool condition, Func<T, ValueTask<Result<TK>>> func)

Parameters

result Result<T>

The result to check.

condition bool

The condition that must be true for the check to run.

func Func<T, ValueTask<Result<TK>>>

The async validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the condition is false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(Result<T>, Func<T, bool>, Func<T, Task<Result<TK>>>)

Conditionally runs an async validation function when the predicate returns true. Only the check function is async; the input is sync.

public static Task<Result<T>> CheckIfAsync<T, TK>(this Result<T> result, Func<T, bool> predicate, Func<T, Task<Result<TK>>> func)

Parameters

result Result<T>

The result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, Task<Result<TK>>>

The async validation function that returns a Result.

Returns

Task<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).

CheckIfAsync<T, TK>(Result<T>, Func<T, bool>, Func<T, ValueTask<Result<TK>>>)

Conditionally runs an async validation function when the predicate returns true. Only the check function is async (ValueTask); the input is sync.

public static ValueTask<Result<T>> CheckIfAsync<T, TK>(this Result<T> result, Func<T, bool> predicate, Func<T, ValueTask<Result<TK>>> func)

Parameters

result Result<T>

The result to check.

predicate Func<T, bool>

The predicate to evaluate against the success value.

func Func<T, ValueTask<Result<TK>>>

The async validation function that returns a Result.

Returns

ValueTask<Result<T>>

The original result if the predicate returns false or the check passes; otherwise the check's failure.

Type Parameters

T

Type of the original result value.

TK

Type of the check function's result value (discarded on success).