Class CheckExtensionsAsync
- Namespace
- Trellis
- Assembly
- Trellis.Results.dll
Async Check extensions where BOTH input and check function are async (Task).
public static class CheckExtensionsAsync
- Inheritance
-
CheckExtensionsAsync
- Inherited Members
Remarks
Users should capture CancellationToken in their lambda closures when cancellation support is needed.
Methods
CheckAsync<T>(Task<Result<T>>, Func<T, Task<Result<Unit>>>)
Asynchronously runs a validation function that returns Result<TValue> on the success value, preserving the original value on success. Both the input and the check function are async.
public static Task<Result<T>> CheckAsync<T>(this Task<Result<T>> resultTask, Func<T, Task<Result<Unit>>> func)
Parameters
resultTaskTask<Result<T>>The task containing the result to check.
funcFunc<T, Task<Result<Unit>>>The async validation function that returns a Result of Unit.
Returns
Type Parameters
TType of the original result value.
CheckAsync<T>(Task<Result<T>>, Func<T, Result<Unit>>)
Asynchronously runs a sync validation function that returns Result<TValue> on the success value, preserving the original value on success. Only the input is async; the check function is sync.
public static Task<Result<T>> CheckAsync<T>(this Task<Result<T>> resultTask, Func<T, Result<Unit>> func)
Parameters
resultTaskTask<Result<T>>The task containing the result to check.
funcFunc<T, Result<Unit>>The sync validation function that returns a Result of Unit.
Returns
Type Parameters
TType of the original result value.
CheckAsync<T>(ValueTask<Result<T>>, Func<T, ValueTask<Result<Unit>>>)
Asynchronously runs a validation function that returns Result<TValue> on the success value, preserving the original value on success. Both the input and the check function are async (ValueTask).
public static ValueTask<Result<T>> CheckAsync<T>(this ValueTask<Result<T>> resultTask, Func<T, ValueTask<Result<Unit>>> func)
Parameters
resultTaskValueTask<Result<T>>The async result to check.
funcFunc<T, ValueTask<Result<Unit>>>The async validation function that returns a Result of Unit.
Returns
Type Parameters
TType of the original result value.
CheckAsync<T>(ValueTask<Result<T>>, Func<T, Result<Unit>>)
Asynchronously runs a sync validation function that returns Result<TValue> on the success value, preserving the original value on success. Only the input is async (ValueTask); the check function is sync.
public static ValueTask<Result<T>> CheckAsync<T>(this ValueTask<Result<T>> resultTask, Func<T, Result<Unit>> func)
Parameters
resultTaskValueTask<Result<T>>The async result to check.
funcFunc<T, Result<Unit>>The sync validation function that returns a Result of Unit.
Returns
Type Parameters
TType of the original result value.
CheckAsync<T>(Result<T>, Func<T, Task<Result<Unit>>>)
Runs an async validation function that returns Result<TValue> on the sync success value, preserving the original value on success. Only the check function is async; the input is sync.
public static Task<Result<T>> CheckAsync<T>(this Result<T> result, Func<T, Task<Result<Unit>>> func)
Parameters
resultResult<T>The result to check.
funcFunc<T, Task<Result<Unit>>>The async validation function that returns a Result of Unit.
Returns
Type Parameters
TType of the original result value.
CheckAsync<T>(Result<T>, Func<T, ValueTask<Result<Unit>>>)
Runs an async validation function that returns Result<TValue> on the sync success value, preserving the original value on success. Only the check function is async (ValueTask); the input is sync.
public static ValueTask<Result<T>> CheckAsync<T>(this Result<T> result, Func<T, ValueTask<Result<Unit>>> func)
Parameters
resultResult<T>The result to check.
funcFunc<T, ValueTask<Result<Unit>>>The async validation function that returns a Result of Unit.
Returns
Type Parameters
TType of the original result value.
CheckAsync<T, TK>(Task<Result<T>>, Func<T, Task<Result<TK>>>)
Asynchronously runs a validation function on the success value, discarding the check result's value on success and preserving the original value. If the check fails, its failure is returned. Both the input and the check function are async.
public static Task<Result<T>> CheckAsync<T, TK>(this Task<Result<T>> resultTask, Func<T, Task<Result<TK>>> func)
Parameters
resultTaskTask<Result<T>>The task containing the result to check.
funcFunc<T, Task<Result<TK>>>The async validation function that returns a Result.
Returns
Type Parameters
TType of the original result value.
TKType of the check function's result value (discarded on success).
CheckAsync<T, TK>(Task<Result<T>>, Func<T, Result<TK>>)
Asynchronously runs a sync validation function on the success value, discarding the check result's value on success and preserving the original value. If the check fails, its failure is returned. Only the input is async; the check function is sync.
public static Task<Result<T>> CheckAsync<T, TK>(this Task<Result<T>> resultTask, Func<T, Result<TK>> func)
Parameters
resultTaskTask<Result<T>>The task containing the result to check.
funcFunc<T, Result<TK>>The sync validation function that returns a Result.
Returns
Type Parameters
TType of the original result value.
TKType of the check function's result value (discarded on success).
CheckAsync<T, TK>(ValueTask<Result<T>>, Func<T, ValueTask<Result<TK>>>)
Asynchronously runs a validation function on the success value, discarding the check result's value on success and preserving the original value. If the check fails, its failure is returned. Both the input and the check function are async (ValueTask).
public static ValueTask<Result<T>> CheckAsync<T, TK>(this ValueTask<Result<T>> resultTask, Func<T, ValueTask<Result<TK>>> func)
Parameters
resultTaskValueTask<Result<T>>The async result to check.
funcFunc<T, ValueTask<Result<TK>>>The async validation function that returns a Result.
Returns
Type Parameters
TType of the original result value.
TKType of the check function's result value (discarded on success).
CheckAsync<T, TK>(ValueTask<Result<T>>, Func<T, Result<TK>>)
Asynchronously runs a sync validation function on the success value, discarding the check result's value on success and preserving the original value. If the check fails, its failure is returned. Only the input is async (ValueTask); the check function is sync.
public static ValueTask<Result<T>> CheckAsync<T, TK>(this ValueTask<Result<T>> resultTask, Func<T, Result<TK>> func)
Parameters
resultTaskValueTask<Result<T>>The async result to check.
funcFunc<T, Result<TK>>The sync validation function that returns a Result.
Returns
Type Parameters
TType of the original result value.
TKType of the check function's result value (discarded on success).
CheckAsync<T, TK>(Result<T>, Func<T, Task<Result<TK>>>)
Runs an async validation function on the sync success value, discarding the check result's value on success and preserving the original value. If the check fails, its failure is returned. Only the check function is async; the input is sync.
public static Task<Result<T>> CheckAsync<T, TK>(this Result<T> result, Func<T, Task<Result<TK>>> func)
Parameters
resultResult<T>The result to check.
funcFunc<T, Task<Result<TK>>>The async validation function that returns a Result.
Returns
Type Parameters
TType of the original result value.
TKType of the check function's result value (discarded on success).
CheckAsync<T, TK>(Result<T>, Func<T, ValueTask<Result<TK>>>)
Runs an async validation function on the sync success value, discarding the check result's value on success and preserving the original value. If the check fails, its failure is returned. Only the check function is async (ValueTask); the input is sync.
public static ValueTask<Result<T>> CheckAsync<T, TK>(this Result<T> result, Func<T, ValueTask<Result<TK>>> func)
Parameters
resultResult<T>The result to check.
funcFunc<T, ValueTask<Result<TK>>>The async validation function that returns a Result.
Returns
Type Parameters
TType of the original result value.
TKType of the check function's result value (discarded on success).