feat: add Result.FailureVal and Result.SuccessVal

This commit is contained in:
Kyle Ratti 2023-08-01 22:55:30 -04:00
parent a5a7c312e3
commit 35cc366856
No known key found for this signature in database
GPG Key ID: 067C5D2D7C62E0F8

View File

@ -22,6 +22,10 @@ public readonly struct Result<TSuccess, TFailure>
public bool IsSuccess => _successVal.HasValue; public bool IsSuccess => _successVal.HasValue;
public bool IsFailure => _failureVal.HasValue; public bool IsFailure => _failureVal.HasValue;
public TSuccess SuccessVal => _successVal.Value;
public TFailure FailureVal => _failureVal.Value;
public bool TrySuccess(out TSuccess output) public bool TrySuccess(out TSuccess output)
{ {
if (!_successVal.Try(out output)) if (!_successVal.Try(out output))