clickhouse_arrow_derive/
lib.rs

1#![allow(clippy::uninlined_format_args)]
2
3#[macro_use]
4extern crate syn;
5#[macro_use]
6extern crate quote;
7
8mod ast;
9mod attr;
10mod bound;
11mod case;
12mod check;
13mod ctxt;
14mod dummy;
15mod fragment;
16mod internal;
17mod receiver;
18mod respan;
19mod row;
20mod symbol;
21
22use proc_macro::TokenStream;
23use syn::DeriveInput;
24
25fn to_compile_errors(errors: Vec<syn::Error>) -> proc_macro2::TokenStream {
26    let compile_errors = errors.iter().map(syn::Error::to_compile_error);
27    quote!(#(#compile_errors)*)
28}
29
30#[proc_macro_derive(Row, attributes(clickhouse_arrow))]
31pub fn derive_serialize(input: TokenStream) -> TokenStream {
32    let mut input = parse_macro_input!(input as DeriveInput);
33    row::expand_derive_serialize(&mut input).unwrap_or_else(to_compile_errors).into()
34}