Class CheckIfExtensionsAsync
- Namespace
- Trellis
- Assembly
- Trellis.Core.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
resultTaskTask<Result<T>>The task containing the result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType 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
resultTaskTask<Result<T>>The task containing the result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType 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
resultTaskTask<Result<T>>The task containing the result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType 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
resultTaskTask<Result<T>>The task containing the result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType 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
resultTaskValueTask<Result<T>>The async result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType 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
resultTaskValueTask<Result<T>>The async result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType 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
resultTaskValueTask<Result<T>>The async result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType 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
resultTaskValueTask<Result<T>>The async result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType 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
resultResult<T>The result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType of the original result value.
Remarks
OverloadResolutionPriorityAttribute resolves the historical CS0121 ambiguity against the sibling ValueTask<TResult>-delegate overload on the same sync Result<TValue> receiver for inline async lambdas.
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
resultResult<T>The result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType 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
resultResult<T>The result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType 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
resultResult<T>The result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType 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
resultTaskTask<Result<T>>The task containing the result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType of the original result value.
TKType 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
resultTaskTask<Result<T>>The task containing the result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType of the original result value.
TKType 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
resultTaskTask<Result<T>>The task containing the result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType of the original result value.
TKType 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
resultTaskTask<Result<T>>The task containing the result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType of the original result value.
TKType 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
resultTaskValueTask<Result<T>>The async result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType of the original result value.
TKType 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
resultTaskValueTask<Result<T>>The async result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType of the original result value.
TKType 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
resultTaskValueTask<Result<T>>The async result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType of the original result value.
TKType 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
resultTaskValueTask<Result<T>>The async result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType of the original result value.
TKType 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
resultResult<T>The result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType of the original result value.
TKType of the check function's result value (discarded on success).
Remarks
OverloadResolutionPriorityAttribute resolves the historical CS0121 ambiguity against the sibling ValueTask<TResult>-delegate overload on the same sync Result<TValue> receiver for inline async lambdas.
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
resultResult<T>The result to check.
conditionboolThe condition that must be true for the check to run.
funcFunc<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
TType of the original result value.
TKType 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
resultResult<T>The result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType of the original result value.
TKType 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
resultResult<T>The result to check.
predicateFunc<T, bool>The predicate to evaluate against the success value.
funcFunc<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
TType of the original result value.
TKType of the check function's result value (discarded on success).