Table of Contents

Struct Result<TValue, TStatus>

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

A zero-allocation result type for hot-path methods. TValue is the data; TStatus is a per-subsystem byte enum. Convention: status value 0 = Success in all enums.

public readonly struct Result<TValue, TStatus> where TValue : unmanaged where TStatus : unmanaged, Enum

Type Parameters

TValue

Unmanaged value returned on success; read only after checking IsSuccess.

TStatus

Unmanaged byte-sized status enum where 0 denotes success.

Inherited Members

Constructors

Result(TValue)

Creates a successful result with the specified value and default (zero) status.

public Result(TValue value)

Parameters

value TValue

Result(TValue, TStatus)

Creates a result with both a value and an explicit status (e.g., Deleted with revision metadata).

public Result(TValue value, TStatus status)

Parameters

value TValue
status TStatus

Result(TStatus)

Creates a failure result with the specified status and default value.

public Result(TStatus status)

Parameters

status TStatus

Fields

Status

The status code. Zero means success by convention.

public readonly TStatus Status

Field Value

TStatus

Value

The value returned by the operation. Only meaningful when IsSuccess is true.

public readonly TValue Value

Field Value

TValue

Properties

IsFailure

True when Status != 0.

public bool IsFailure { get; }

Property Value

bool

IsSuccess

True when Status == 0 (Success by convention). No boxing — single byte comparison.

public bool IsSuccess { get; }

Property Value

bool