| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | namespace ZeroC.Slice; |
| | 4 | |
|
| | 5 | | /// <summary>A discriminated union that represents either a success or a failure. It is typically used as the return |
| | 6 | | /// type of Slice operations.</summary> |
| | 7 | | /// <typeparam name="TSuccess">The success type.</typeparam> |
| | 8 | | /// <typeparam name="TFailure">The failure type.</typeparam> |
| | 9 | | /// <remarks>The Slice Result type (a built-in generic type) maps to this generic class in C#. The Dunet source |
| | 10 | | /// generator provides many methods (Match, MatchSuccess, MatchFailure, MatchAsync, UnwrapSuccess, UnwrapFailure and |
| | 11 | | /// more) for this generic class. See <see href="https://github.com/domn1995/dunet" /> for more information.</remarks> |
| | 12 | | [Dunet.Union] |
| | 13 | | public abstract partial record class Result<TSuccess, TFailure> |
| | 14 | | { |
| | 15 | | /// <summary>Represents a successful <see cref="Result{TSuccess, TFailure}" />.</summary> |
| | 16 | | /// <param name="Value">The value of type <typeparamref name="TSuccess"/>.</param> |
| 7 | 17 | | public partial record class Success(TSuccess Value); |
| | 18 | |
|
| | 19 | | /// <summary>Represents a failed <see cref="Result{TSuccess, TFailure}" />.</summary> |
| | 20 | | /// <param name="Value">The value of type <typeparamref name="TFailure"/>.</param> |
| 11 | 21 | | public partial record class Failure(TFailure Value); |
| | 22 | | } |