Available languages: [Python](https://databento.com/docs/api-historical/helpers/dbn-store-decode-record-ref.python.md) · [C++](https://databento.com/docs/api-historical/helpers/dbn-store-decode-record-ref.cpp.md) · [Rust](https://databento.com/docs/api-historical/helpers/dbn-store-decode-record-ref.rust.md) · [HTTP](https://databento.com/docs/api-historical/helpers/dbn-store-decode-record-ref.http.md)

Source: https://databento.com/docs/api-historical/helpers/dbn-store-decode-record-ref


### AsyncDbnStore::decode_record_ref

Decode a single record of an unknown type.

#### API method

```rust
pub async fn decode_record_ref(
    &mut self,
) -> dbn::Result<Option<RecordRef>>;
```

#### Returns

A [RecordRef](https://databento.com/docs/api-historical/helpers/record-ref.md)--a wrapper around a record of a dynamic type--or `Ok(None)` if the stream has been exhausted.

This function will return an error if there's an error reading from the input stream.

#### Example usage

```rust
use databento::{
    HistoricalClient,
    dbn::{OhlcvMsg, SType, Schema},
    historical::timeseries::GetRangeParams,
};
use time::macros::datetime;

let mut client =
    HistoricalClient::builder().key("$YOUR_API_KEY")?.build()?;
let mut decoder = client
    .timeseries()
    .get_range(
        &GetRangeParams::builder()
            .dataset("OPRA.PILLAR")
            .stype_in(SType::Parent)
            .date_time_range(
                datetime!(2023-08-07 00:00 UTC)
                    ..datetime!(2023-08-08 00:00 UTC),
            )
            .symbols("SPXW.OPT")
            .schema(Schema::Ohlcv1H)
            .build(),
    )
    .await?;
let bar = decoder.decode_record::<OhlcvMsg>().await?.unwrap();
println!("{bar:#?}");
```
#### Example response

```plaintext
OhlcvMsg {
    hd: RecordHeader {
        length: 14,
        rtype: Ohlcv1H,
        publisher_id: OpraPillarXcbo,
        instrument_id: 587251818,
        ts_event: 1691413200000000000,
    },
    open: 85.060000000,
    high: 85.060000000,
    low: 85.060000000,
    close: 85.060000000,
    volume: 1,
}
```
