Struct AsyncComputeResult<T>
Structure representing the result of an asynchronous auto-observable computation.
Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: TinkState
Assembly: Nadako.TinkState.dll
Syntax
public readonly struct AsyncComputeResult<T>
Type Parameters
Name | Description |
---|---|
T | Type of the value returned by the computation. |
Remarks
The actual structure depends on the Status field:
Fields
Exception
Exception representing an error that happened during computation. Only available when Status is Failed.
Declaration
public readonly Exception Exception
Field Value
Type | Description |
---|---|
System.Exception |
Result
Declaration
public readonly T Result
Field Value
Type | Description |
---|---|
T |
Status
Current status of the value computation.
Declaration
public readonly AsyncComputeStatus Status
Field Value
Type | Description |
---|---|
AsyncComputeStatus |
Methods
CreateDone(T)
Return a new instance with the Done status and given
result
value.
Declaration
public static AsyncComputeResult<T> CreateDone(T result)
Parameters
Type | Name | Description |
---|---|---|
T | result |
Returns
Type | Description |
---|---|
AsyncComputeResult<T> |
CreateFailed(Exception)
Return a new instance with the Failed status and given
exception
.
Declaration
public static AsyncComputeResult<T> CreateFailed(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exception |
Returns
Type | Description |
---|---|
AsyncComputeResult<T> |
CreateLoading()
Return a new instance with the Loading status.
Declaration
public static AsyncComputeResult<T> CreateLoading()
Returns
Type | Description |
---|---|
AsyncComputeResult<T> |
Map<TOut>(Func<T, TOut>)
Transform the successful result value to another type using given
transform
function.
If current Status is not Done, then simply create an instance
with the same status (and possibly Exception) as this one.
Declaration
public readonly AsyncComputeResult<TOut> Map<TOut>(Func<T, TOut> transform)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TOut> | transform | Value transformation function. |
Returns
Type | Description |
---|---|
AsyncComputeResult<TOut> | New AsyncComputeResult instance for given value output type. |
Type Parameters
Name | Description |
---|---|
TOut | Type of the transformed value. |