Table of Contents

Class PublisherValues

Namespace
DatabentoDotNet.Dbn.Publishers
Assembly
DatabentoDotNet.Dbn.dll

Validates a raw wire word against the discriminants Publisher, Dataset, and Venue actually define.

public static class PublisherValues
Inheritance
PublisherValues
Inherited Members

Remarks

What EnumValues is for the enums declared directly in DatabentoDotNet.Dbn, this is for the three declared here -- the equivalent of upstream's num_enum-derived TryFrom<u16> impls. They are not folded into EnumValues because these three tables are generated: keeping the validator beside the enum it validates means a dbn release bump regenerates both from one source, where a hand-maintained half in another namespace would have to be remembered.

This is the checked conversion for PublisherId, which is a raw ushort off the wire and is not validated on decode -- the same arrangement RawRType has with TryFromRType(byte, out RType). Casting an unvalidated word to Publisher and then calling ToVenue(Publisher) turns an unknown publisher into an ArgumentOutOfRangeException from deep inside a lookup; going through TryFromPublisher(ushort, out Publisher) first makes it a bool the caller decides about.

Strict, like every validator in EnumValues: an undefined word is rejected even though upstream marks all three types #[non_exhaustive]. #[non_exhaustive] governs whether downstream Rust may exhaustively match the type, not whether an arbitrary word is a valid instance of it. Rejection here is the numeric out-of-range failure mode; an unrecognized wire string is a distinct failure handled by PublisherWireStrings.

One method per enum rather than a single TryFrom overloaded on its 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. Same convention as EnumValues and PublisherWireStrings.

Methods

TryFromDataset(ushort, out Dataset)

Tries to validate raw as a defined Dataset.

public static bool TryFromDataset(ushort raw, out Dataset value)

Parameters

raw ushort

The raw wire word.

value Dataset

The validated Dataset, or default when raw is not one.

Returns

bool

true when raw is a defined Dataset.

TryFromPublisher(ushort, out Publisher)

Tries to validate raw as a defined Publisher.

public static bool TryFromPublisher(ushort raw, out Publisher value)

Parameters

raw ushort

The raw wire word, such as PublisherId.

value Publisher

The validated Publisher, or default when raw is not one.

Returns

bool

true when raw is a defined Publisher.

TryFromVenue(ushort, out Venue)

Tries to validate raw as a defined Venue.

public static bool TryFromVenue(ushort raw, out Venue value)

Parameters

raw ushort

The raw wire word.

value Venue

The validated Venue, or default when raw is not one.

Returns

bool

true when raw is a defined Venue.