> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# decode_records

> decode_records — Kinetica Rust API

[gpudb\_api](https://docs.kinetica.com/content/api/rust/index.md)::<wbr />[avro](https://docs.kinetica.com/content/api/rust/avro/index.md)
[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/avro.rs#L409-L422)&#x20;

<pre>`pub fn decode_records<T: DeserializeOwned + Send, B: AsRef<[u8]> + Sync>(    schema: &Schema,    binary_records: &[B],) -> Result<Vec<T>, KineticaError>`</pre>

Decodes binary Avro records to typed Rust structs.This is the **recommended** decoding function. It automatically chooses between sequential and parallel decoding based on record count, and uses `serde_avro_fast` for optimal performance.

## Type Parameters

<ul>
  <li>`T` - The target type to decode into. Must implement `serde::Deserialize`.</li>
</ul>

## Arguments

<ul>
  <li>`schema` - The serde\_avro\_fast schema to use for decoding</li>
  <li>`binary_records` - Slice of binary Avro-encoded records</li>
</ul>

## Returns

A vector of decoded typed records, or an error if any record fails to decode.

## Example

```rust theme={null}
use gpudb_api::avro::{decode_records, parse_fast_schema};

#[derive(serde::Deserialize)]
struct Employee { id: i32, name: String, salary: f64 }

let response = kinetica.get_records_raw(&request).await?;
let schema = parse_fast_schema(&response.type_schema)?;
let employees: Vec<Employee> = decode_records(&schema, &response.records_binary)?;
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.