Section navigation

Public structRead-only CodecResult<T>

Namespace
Rowles.LeanCorpus.Codecs.CodecKit.Codecs
Assembly
Rowles.LeanCorpus.dll

Represents the result of a non-throwing codec operation. Access Value on success or Failure on failure. Accessing the wrong property throws InvalidOperationException.

public readonly struct CodecResult<T>

Type Parameters

T

Public property Failure

The failure metadata. Throws InvalidOperationException if the operation succeeded.

Public property IsFailure

True if the operation failed.

Public property IsSuccess

True if the operation succeeded.

Public property Value

The decoded/encoded value. Throws InvalidOperationException if the operation failed.

Public method Fail(CodecFailure)

Creates a failed result from a CodecFailure.

Public method Fail(CodecException)

Creates a failed result from a CodecException.

Public method Success(T)

Creates a successful result.