Class ResultLinqExtensionsValueTaskAsync
- Namespace
- Trellis
- Assembly
- Trellis.Core.dll
Provides LINQ query expression support for ValueTask<TResult> of Result<TValue>, enabling C# query syntax over fully asynchronous Result-returning operations that may complete synchronously.
public static class ResultLinqExtensionsValueTaskAsync
- Inheritance
-
ResultLinqExtensionsValueTaskAsync
- Inherited Members
Remarks
These overloads match the C# query-pattern signatures (Select, SelectMany, Where)
for an async receiver and async continuations. Semantics mirror ResultLinqExtensions:
failures short-circuit subsequent steps; only success values flow through.
Methods
SelectMany<TSource, TCollection, TResult>(ValueTask<Result<TSource>>, Func<TSource, ValueTask<Result<TCollection>>>, Func<TSource, TCollection, TResult>)
Projects the value of an awaited Result<TValue> through an async collection selector
and combines the results (LINQ SelectMany over async/async, ValueTask variant).
public static ValueTask<Result<TResult>> SelectMany<TSource, TCollection, TResult>(this ValueTask<Result<TSource>> source, Func<TSource, ValueTask<Result<TCollection>>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
Parameters
sourceValueTask<Result<TSource>>The asynchronous source result.
collectionSelectorFunc<TSource, ValueTask<Result<TCollection>>>An async function returning the intermediate result.
resultSelectorFunc<TSource, TCollection, TResult>A synchronous function combining the source and intermediate values.
Returns
- ValueTask<Result<TResult>>
A value task producing the combined result, or the first failure encountered.
Type Parameters
TSourceType of the source value.
TCollectionType of the intermediate collection value.
TResultType of the final projected value.
Select<TIn, TOut>(ValueTask<Result<TIn>>, Func<TIn, TOut>)
Projects the value of an awaited Result<TValue> using a synchronous selector
(LINQ Select over ValueTask<TResult>).
public static ValueTask<Result<TOut>> Select<TIn, TOut>(this ValueTask<Result<TIn>> resultTask, Func<TIn, TOut> selector)
Parameters
resultTaskValueTask<Result<TIn>>The asynchronous result to project.
selectorFunc<TIn, TOut>The projection function applied to the success value.
Returns
- ValueTask<Result<TOut>>
A value task producing a result with the projected value, or the original failure.
Type Parameters
TInThe type of the input value.
TOutThe type of the output value.
Where<TSource>(ValueTask<Result<TSource>>, Func<TSource, bool>)
Filters an awaited Result<TValue> by a synchronous predicate
(LINQ Where over ValueTask<TResult>).
public static ValueTask<Result<TSource>> Where<TSource>(this ValueTask<Result<TSource>> source, Func<TSource, bool> predicate)
Parameters
sourceValueTask<Result<TSource>>The asynchronous result to filter.
predicateFunc<TSource, bool>The predicate to test the success value.
Returns
- ValueTask<Result<TSource>>
The original success when the predicate is true; otherwise a generic "filtered out" failure.
Type Parameters
TSourceType of the source value.