Struct FlowResult<T>
- Namespace
- SharpConsoleUI.Flows
- Assembly
- SharpConsoleUI.dll
Represents the outcome of a completed flow run, carrying either a typed value, a cancellation signal, or a fault with the originating exception.
public readonly struct FlowResult<T>
Type Parameters
TThe type of value produced by a successfully completed flow.
- Inherited Members
- Extension Methods
Properties
Cancelled
true when the flow was cancelled by the user or the host.
public bool Cancelled { get; }
Property Value
Completed
true when the flow completed successfully and Value is valid.
public bool Completed { get; }
Property Value
Error
The exception that caused the fault. Only meaningful when Faulted is true.
public Exception? Error { get; }
Property Value
Faulted
true when the flow terminated due to an unhandled exception.
public bool Faulted { get; }
Property Value
Value
The value produced by the flow. Only meaningful when Completed is true.
public T? Value { get; }
Property Value
- T
Methods
Cancel()
Creates a cancellation result indicating the flow was abandoned.
public static FlowResult<T> Cancel()
Returns
- FlowResult<T>
A FlowResult<T> with Cancelled set to
true.
Complete(T)
Creates a successful completion result carrying value.
public static FlowResult<T> Complete(T value)
Parameters
valueTThe value produced by the flow.
Returns
- FlowResult<T>
A FlowResult<T> with Completed set to
true.
Fault(Exception)
Creates a fault result wrapping the given exception.
public static FlowResult<T> Fault(Exception error)
Parameters
errorExceptionThe exception that caused the flow to fault.
Returns
- FlowResult<T>
A FlowResult<T> with Faulted set to
true.