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
Returns
TryFromCompression(byte, out Compression)
Tries to validate raw as a defined Compression.
public static bool TryFromCompression(byte raw, out Compression value)
Parameters
rawbytevalueCompression
Returns
TryFromEncoding(byte, out Encoding)
Tries to validate raw as a defined Encoding.
public static bool TryFromEncoding(byte raw, out Encoding value)
Parameters
Returns
TryFromErrorCode(byte, out ErrorCode)
Tries to validate raw as a defined ErrorCode.
public static bool TryFromErrorCode(byte raw, out ErrorCode value)
Parameters
Returns
TryFromInstrumentClass(byte, out InstrumentClass)
Tries to validate raw as a defined InstrumentClass.
public static bool TryFromInstrumentClass(byte raw, out InstrumentClass value)
Parameters
rawbytevalueInstrumentClass
Returns
TryFromMatchAlgorithm(byte, out MatchAlgorithm)
Tries to validate raw as a defined MatchAlgorithm.
public static bool TryFromMatchAlgorithm(byte raw, out MatchAlgorithm value)
Parameters
rawbytevalueMatchAlgorithm
Returns
TryFromRType(byte, out RType)
Tries to validate raw as a defined RType.
public static bool TryFromRType(byte raw, out RType value)
Parameters
Returns
TryFromSType(byte, out SType)
Tries to validate raw as a defined SType.
public static bool TryFromSType(byte raw, out SType value)
Parameters
Returns
TryFromSchema(ushort, out Schema)
Tries to validate raw as a defined Schema.
public static bool TryFromSchema(ushort raw, out Schema value)
Parameters
Returns
TryFromSecurityUpdateAction(byte, out SecurityUpdateAction)
Tries to validate raw as a defined SecurityUpdateAction.
public static bool TryFromSecurityUpdateAction(byte raw, out SecurityUpdateAction value)
Parameters
rawbytevalueSecurityUpdateAction
Returns
TryFromSide(byte, out Side)
Tries to validate raw as a defined Side.
public static bool TryFromSide(byte raw, out Side value)
Parameters
Returns
TryFromStatType(ushort, out StatType)
Tries to validate raw as a defined StatType.
public static bool TryFromStatType(ushort raw, out StatType value)
Parameters
Returns
TryFromStatUpdateAction(byte, out StatUpdateAction)
Tries to validate raw as a defined StatUpdateAction.
public static bool TryFromStatUpdateAction(byte raw, out StatUpdateAction value)
Parameters
rawbytevalueStatUpdateAction
Returns
TryFromStatusAction(ushort, out StatusAction)
Tries to validate raw as a defined StatusAction.
public static bool TryFromStatusAction(ushort raw, out StatusAction value)
Parameters
rawushortvalueStatusAction
Returns
TryFromStatusReason(ushort, out StatusReason)
Tries to validate raw as a defined StatusReason.
public static bool TryFromStatusReason(ushort raw, out StatusReason value)
Parameters
rawushortvalueStatusReason
Returns
TryFromSystemCode(byte, out SystemCode)
Tries to validate raw as a defined SystemCode.
public static bool TryFromSystemCode(byte raw, out SystemCode value)
Parameters
rawbytevalueSystemCode
Returns
TryFromTradingEvent(ushort, out TradingEvent)
Tries to validate raw as a defined TradingEvent.
public static bool TryFromTradingEvent(ushort raw, out TradingEvent value)
Parameters
rawushortvalueTradingEvent
Returns
TryFromTriState(byte, out TriState)
Tries to validate raw as a defined TriState.
public static bool TryFromTriState(byte raw, out TriState value)
Parameters
Returns
TryFromUserDefinedInstrument(byte, out UserDefinedInstrument)
Tries to validate raw as a defined UserDefinedInstrument.
public static bool TryFromUserDefinedInstrument(byte raw, out UserDefinedInstrument value)
Parameters
rawbytevalueUserDefinedInstrument
Returns
TryFromVersionUpgradePolicy(byte, out VersionUpgradePolicy)
Tries to validate raw as a defined VersionUpgradePolicy.
public static bool TryFromVersionUpgradePolicy(byte raw, out VersionUpgradePolicy value)
Parameters
rawbytevalueVersionUpgradePolicy