[−][src]Derive Macro amadeus_parquet_derive::Record
#[derive(Record)] { // Attributes available to this derive: #[parquet] }
This is a procedural macro to derive the Record
trait on
structs and enums.
Example
use amadeus_parquet::internal;
use internal::record::Record;
#[derive(Record, Debug)]
struct MyRow {
id: u64,
time: Timestamp,
event: String,
}
If the Rust field name and the Parquet field name differ, say if the latter is not an idiomatic or valid identifier in Rust, then an automatic rename can be made like so:
#[derive(Record, Debug)]
struct MyRow {
#[parquet(name = "ID")]
id: u64,
time: Timestamp,
event: String,
}
Implementation
This macro works by creating two new structs: StructSchema and StructReader
(where "Struct" is the name of the user's struct). These structs implement the
Schema
and Reader
traits
respectively. Record
can then be implemented on the
user's struct.