docs(result): document that failure equality ignores error content
Result/Result<T> equality treats any two failures as equal regardless of their Error, which was undocumented and surprising for failure-specific branching.
This commit is contained in:
parent
fbbe94bfa8
commit
ab9407085d
3 changed files with 39 additions and 3 deletions
|
|
@ -9,7 +9,15 @@ namespace Geekeey.Request.Result;
|
|||
|
||||
public partial class Result : IEquatable<Result>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
/// <summary>
|
||||
/// Checks whether two results are equal. Results are equal if both are success or both are failure.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Two failures are considered equal regardless of their <see cref="Error"/> content. Equality therefore
|
||||
/// ignores the error; if you need to branch on a specific failure, compare the <see cref="Error"/> values
|
||||
/// directly instead of relying on equality.
|
||||
/// </remarks>
|
||||
/// <param name="other">The result to check for equality with the current result.</param>
|
||||
[Pure]
|
||||
public bool Equals(Result? other)
|
||||
{
|
||||
|
|
@ -49,7 +57,8 @@ public partial class Result : IEquatable<Result>
|
|||
public partial class Result : IEqualityOperators<Result, Result, bool>
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks whether two results are equal. Results are equal if they are both success or both failure.
|
||||
/// Checks whether two results are equal. Results are equal if they are both success or both failure. Two
|
||||
/// failures are equal regardless of their error content.
|
||||
/// </summary>
|
||||
/// <param name="a">The first result to compare.</param>
|
||||
/// <param name="b">The second result to compare.</param>
|
||||
|
|
@ -79,6 +88,11 @@ public partial class Result<T> : IEquatable<Result<T>>, IEquatable<T>
|
|||
/// Checks whether the result is equal to another result. Results are equal if both results are success values and
|
||||
/// the success values are equal, or if both results are failures.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Two failures are considered equal regardless of their <see cref="Error"/> content. Equality therefore
|
||||
/// ignores the error; if you need to branch on a specific failure, compare the <see cref="Error"/> values
|
||||
/// directly instead of relying on equality.
|
||||
/// </remarks>
|
||||
/// <param name="other">The result to check for equality with the current result.</param>
|
||||
[Pure]
|
||||
public bool Equals(Result<T>? other)
|
||||
|
|
@ -194,7 +208,7 @@ public partial class Result<T> : IEqualityOperators<Result<T>, Result<T>, bool>,
|
|||
{
|
||||
/// <summary>
|
||||
/// Checks whether two results are equal. Results are equal if both results are success values and the success
|
||||
/// values are equal, or if both results are failures.
|
||||
/// values are equal, or if both results are failures. Two failures are equal regardless of their error content.
|
||||
/// </summary>
|
||||
/// <param name="a">The first result to compare.</param>
|
||||
/// <param name="b">The second result to compare.</param>
|
||||
|
|
|
|||
Loading…
Reference in a new issue