Skip to content

Commit

Permalink
Add entity interface for parity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nihlus committed May 5, 2023
1 parent fd7064a commit 806de47
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion Remora.Results/IResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@

namespace Remora.Results;

#pragma warning disable SA1402

/// <summary>
/// Represents the public API of an interface.
/// Represents the public API of a result.
/// </summary>
[PublicAPI]
public interface IResult
Expand All @@ -47,3 +49,17 @@ public interface IResult
/// </summary>
IResult? Inner { get; }
}

/// <summary>
/// Represents the public API of a result with a contained value.
/// </summary>
/// <typeparam name="TEntity">The type of the contained value.</typeparam>
[PublicAPI]
public interface IResult<out TEntity> : IResult
{
/// <summary>
/// Gets the entity returned by the result.
/// </summary>
[AllowNull]
TEntity Entity { get; }
}
2 changes: 1 addition & 1 deletion Remora.Results/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public static implicit operator Result(Exception exception)

/// <inheritdoc />
[PublicAPI]
public readonly struct Result<TEntity> : IResult
public readonly struct Result<TEntity> : IResult<TEntity>
{
/// <summary>
/// Gets the entity returned by the result.
Expand Down

0 comments on commit 806de47

Please sign in to comment.