Class MapExtensionsAsync
- Namespace
- FunctionalDdd
- Assembly
- FunctionalDdd.RailwayOrientedProgramming.dll
Provides asynchronous extension methods for mapping (transforming) values inside Result objects.
public static class MapExtensionsAsync
- Inheritance
-
MapExtensionsAsync
- Inherited Members
Methods
MapAsync<TIn, TOut>(Result<TIn>, Func<TIn, Task<TOut>>)
Asynchronously maps the value of a successful result to a new value using the provided async function.
public static Task<Result<TOut>> MapAsync<TIn, TOut>(this Result<TIn> result, Func<TIn, Task<TOut>> func)
Parameters
resultResult<TIn>The result to map.
funcFunc<TIn, Task<TOut>>The async function to transform the value if the result is successful.
Returns
- Task<Result<TOut>>
A new success result with the transformed value if success; otherwise the original failure.
Type Parameters
TInType of the input result value.
TOutType of the output result value.
MapAsync<TIn, TOut>(Result<TIn>, Func<TIn, ValueTask<TOut>>)
Asynchronously maps the value of a successful result to a new value using a ValueTask function.
public static ValueTask<Result<TOut>> MapAsync<TIn, TOut>(this Result<TIn> result, Func<TIn, ValueTask<TOut>> func)
Parameters
resultResult<TIn>The result to map.
funcFunc<TIn, ValueTask<TOut>>The async function to transform the value if the result is successful.
Returns
- ValueTask<Result<TOut>>
A new success result with the transformed value if success; otherwise the original failure.
Type Parameters
TInType of the input result value.
TOutType of the output result value.
MapAsync<TIn, TOut>(Task<Result<TIn>>, Func<TIn, Task<TOut>>)
Asynchronously maps the value of a task result to a new value using an async function.
public static Task<Result<TOut>> MapAsync<TIn, TOut>(this Task<Result<TIn>> resultTask, Func<TIn, Task<TOut>> func)
Parameters
resultTaskTask<Result<TIn>>The task containing the result to map.
funcFunc<TIn, Task<TOut>>The async function to transform the value if the result is successful.
Returns
- Task<Result<TOut>>
A new success result with the transformed value if success; otherwise the original failure.
Type Parameters
TInType of the input result value.
TOutType of the output result value.
MapAsync<TIn, TOut>(Task<Result<TIn>>, Func<TIn, TOut>)
Asynchronously maps the value of a task result to a new value using a synchronous function.
public static Task<Result<TOut>> MapAsync<TIn, TOut>(this Task<Result<TIn>> resultTask, Func<TIn, TOut> func)
Parameters
resultTaskTask<Result<TIn>>The task containing the result to map.
funcFunc<TIn, TOut>The function to transform the value if the result is successful.
Returns
- Task<Result<TOut>>
A new success result with the transformed value if success; otherwise the original failure.
Type Parameters
TInType of the input result value.
TOutType of the output result value.
MapAsync<TIn, TOut>(ValueTask<Result<TIn>>, Func<TIn, ValueTask<TOut>>)
Asynchronously maps the value of a ValueTask result to a new value using an async function.
public static ValueTask<Result<TOut>> MapAsync<TIn, TOut>(this ValueTask<Result<TIn>> resultTask, Func<TIn, ValueTask<TOut>> func)
Parameters
resultTaskValueTask<Result<TIn>>The ValueTask containing the result to map.
funcFunc<TIn, ValueTask<TOut>>The async function to transform the value if the result is successful.
Returns
- ValueTask<Result<TOut>>
A new success result with the transformed value if success; otherwise the original failure.
Type Parameters
TInType of the input result value.
TOutType of the output result value.
MapAsync<TIn, TOut>(ValueTask<Result<TIn>>, Func<TIn, TOut>)
Asynchronously maps the value of a ValueTask result to a new value using a synchronous function.
public static ValueTask<Result<TOut>> MapAsync<TIn, TOut>(this ValueTask<Result<TIn>> resultTask, Func<TIn, TOut> func)
Parameters
resultTaskValueTask<Result<TIn>>The ValueTask containing the result to map.
funcFunc<TIn, TOut>The function to transform the value if the result is successful.
Returns
- ValueTask<Result<TOut>>
A new success result with the transformed value if success; otherwise the original failure.
Type Parameters
TInType of the input result value.
TOutType of the output result value.