Table of Contents

Class EnumValues

Namespace
DatabentoDotNet.Dbn
Assembly
DatabentoDotNet.Dbn.dll

Validates a raw wire byte/word against the discriminants a DBN enum actually defines.

public static class EnumValues
Inheritance
EnumValues
Inherited Members

Remarks

This is the numeric-decode half of enum conversion — the equivalent of the Rust crate's num_enum-derived TryFrom<u8>/TryFrom<u16> impls. It covers every enum declared alongside it directly in DatabentoDotNet.Dbn except FlagSet. Publisher, Dataset, and Venue are wire-validated the same way, but by PublisherValues rather than here: those three tables are generated from the dbn crate's publishers.rs, and their validator is generated beside them so a release bump reproduces both from one source. It answers "is this raw value one of the discriminants this enum defines", independent of any text form. Rejection here is the numeric out-of-range failure mode; an unrecognized wire string is a distinct failure handled by WireStrings — upstream keeps those as two different error types, and this port keeps them as two different call surfaces on purpose.

Every enum here is strict: an undefined raw value is rejected the same way whether or not the enum is #[non_exhaustive] upstream — #[non_exhaustive] only affects whether downstream Rust code can exhaustively match the type, not whether an arbitrary byte is a valid instance of it. FlagSet is the sole exception among the enums covered here: every raw byte is already a valid FlagSet, so it has no entry here — use an explicit cast instead.

Each enum gets its own TryFrom{Enum} method rather than one TryFrom overloaded by the out parameter's type: overload resolution needs that type before it can pick an overload, so out var at a call site — the ordinary way to call a TryXxx method — cannot disambiguate and fails to compile. Per-enum names work with out var the same way TryParse(string, out int) does.

Methods

TryFromAction(byte, out Action)

Tries to validate raw as a defined Action.

public static bool TryFromAction(byte raw, out Action value)

Parameters

raw byte
value Action

Returns

bool

TryFromCompression(byte, out Compression)

Tries to validate raw as a defined Compression.

public static bool TryFromCompression(byte raw, out Compression value)

Parameters

raw byte
value Compression

Returns

bool

TryFromEncoding(byte, out Encoding)

Tries to validate raw as a defined Encoding.

public static bool TryFromEncoding(byte raw, out Encoding value)

Parameters

raw byte
value Encoding

Returns

bool

TryFromErrorCode(byte, out ErrorCode)

Tries to validate raw as a defined ErrorCode.

public static bool TryFromErrorCode(byte raw, out ErrorCode value)

Parameters

raw byte
value ErrorCode

Returns

bool

TryFromInstrumentClass(byte, out InstrumentClass)

Tries to validate raw as a defined InstrumentClass.

public static bool TryFromInstrumentClass(byte raw, out InstrumentClass value)

Parameters

raw byte
value InstrumentClass

Returns

bool

TryFromMatchAlgorithm(byte, out MatchAlgorithm)

Tries to validate raw as a defined MatchAlgorithm.

public static bool TryFromMatchAlgorithm(byte raw, out MatchAlgorithm value)

Parameters

raw byte
value MatchAlgorithm

Returns

bool

TryFromRType(byte, out RType)

Tries to validate raw as a defined RType.

public static bool TryFromRType(byte raw, out RType value)

Parameters

raw byte
value RType

Returns

bool

TryFromSType(byte, out SType)

Tries to validate raw as a defined SType.

public static bool TryFromSType(byte raw, out SType value)

Parameters

raw byte
value SType

Returns

bool

TryFromSchema(ushort, out Schema)

Tries to validate raw as a defined Schema.

public static bool TryFromSchema(ushort raw, out Schema value)

Parameters

raw ushort
value Schema

Returns

bool

TryFromSecurityUpdateAction(byte, out SecurityUpdateAction)

Tries to validate raw as a defined SecurityUpdateAction.

public static bool TryFromSecurityUpdateAction(byte raw, out SecurityUpdateAction value)

Parameters

raw byte
value SecurityUpdateAction

Returns

bool

TryFromSide(byte, out Side)

Tries to validate raw as a defined Side.

public static bool TryFromSide(byte raw, out Side value)

Parameters

raw byte
value Side

Returns

bool

TryFromStatType(ushort, out StatType)

Tries to validate raw as a defined StatType.

public static bool TryFromStatType(ushort raw, out StatType value)

Parameters

raw ushort
value StatType

Returns

bool

TryFromStatUpdateAction(byte, out StatUpdateAction)

Tries to validate raw as a defined StatUpdateAction.

public static bool TryFromStatUpdateAction(byte raw, out StatUpdateAction value)

Parameters

raw byte
value StatUpdateAction

Returns

bool

TryFromStatusAction(ushort, out StatusAction)

Tries to validate raw as a defined StatusAction.

public static bool TryFromStatusAction(ushort raw, out StatusAction value)

Parameters

raw ushort
value StatusAction

Returns

bool

TryFromStatusReason(ushort, out StatusReason)

Tries to validate raw as a defined StatusReason.

public static bool TryFromStatusReason(ushort raw, out StatusReason value)

Parameters

raw ushort
value StatusReason

Returns

bool

TryFromSystemCode(byte, out SystemCode)

Tries to validate raw as a defined SystemCode.

public static bool TryFromSystemCode(byte raw, out SystemCode value)

Parameters

raw byte
value SystemCode

Returns

bool

TryFromTradingEvent(ushort, out TradingEvent)

Tries to validate raw as a defined TradingEvent.

public static bool TryFromTradingEvent(ushort raw, out TradingEvent value)

Parameters

raw ushort
value TradingEvent

Returns

bool

TryFromTriState(byte, out TriState)

Tries to validate raw as a defined TriState.

public static bool TryFromTriState(byte raw, out TriState value)

Parameters

raw byte
value TriState

Returns

bool

TryFromUserDefinedInstrument(byte, out UserDefinedInstrument)

Tries to validate raw as a defined UserDefinedInstrument.

public static bool TryFromUserDefinedInstrument(byte raw, out UserDefinedInstrument value)

Parameters

raw byte
value UserDefinedInstrument

Returns

bool

TryFromVersionUpgradePolicy(byte, out VersionUpgradePolicy)

Tries to validate raw as a defined VersionUpgradePolicy.

public static bool TryFromVersionUpgradePolicy(byte raw, out VersionUpgradePolicy value)

Parameters

raw byte
value VersionUpgradePolicy

Returns

bool