Table of Contents

Class RTypeSchemaMapping

Namespace
DatabentoDotNet.Dbn
Assembly
DatabentoDotNet.Dbn.dll

Conversions between RType and Schema.

public static class RTypeSchemaMapping
Inheritance
RTypeSchemaMapping
Inherited Members

Remarks

The two directions are not exact inverses. Mbp1 and Tbbo both map to Mbp1 via ToRType(Schema), so TryIntoSchema(RType, out Schema) can never recover Tbbo from an Mbp1 byte — it always yields Mbp1. This mirrors the Rust crate's impl From<Schema> for RType and RType::try_into_schema exactly; the further collapse between Cmbp1/Tcbbo at the record-struct dispatch level is out of scope here (it lands with record decoding).

Methods

ToRType(Schema)

Returns the canonical RType for schema.

public static RType ToRType(this Schema schema)

Parameters

schema Schema

Returns

RType

Exceptions

ArgumentOutOfRangeException

schema is not a defined Schema.

TryIntoSchema(RType, out Schema)

Tries to convert an RType — as carried typed by RType — into the Schema it represents.

public static bool TryIntoSchema(RType rtype, out Schema schema)

Parameters

rtype RType

The record type read from a record header.

schema Schema

Receives the schema, or default when there is none.

Returns

bool

true if rtype maps to a schema.

Remarks

The typed counterpart of ToRType(Schema), and the overload to reach for from a decoded record. It delegates to the byte overload, which stays public for callers holding an unvalidated wire byte — an rtype this library has no member for is a false here either way, so the two never disagree.

TryIntoSchema(byte, out Schema)

Tries to convert a raw rtype byte (as carried by RawRType) into the Schema it represents.

public static bool TryIntoSchema(byte rtype, out Schema schema)

Parameters

rtype byte
schema Schema

Returns

bool

Remarks

Returns false for OhlcvDeprecated — it predates the per-cadence OHLCV rtypes and does not map to a single schema — and for the control/meta rtypes Error, SymbolMapping, and System, none of which carry an associated schema. Also returns false for any byte that is not a defined RType at all.