Skip to main content

reifydb_client_derive/
lib.rs

1// SPDX-License-Identifier: MIT
2// Copyright (c) 2026 ReifyDB
3#![cfg_attr(not(debug_assertions), deny(clippy::disallowed_methods))]
4#![cfg_attr(debug_assertions, warn(clippy::disallowed_methods))]
5#![allow(clippy::tabs_in_doc_comments)]
6// SPDX-License-Identifier: MIT
7// Copyright (c) 2026 ReifyDB
8// This file is licensed under the MIT, see license.md file
9
10use proc_macro::TokenStream;
11use reifydb_macro_impl::derive_from_frame_with_crate;
12
13/// Derives `FromFrame` for a struct, enabling deserialization from a Frame.
14///
15/// Generated code references types from the `reifydb_client` crate.
16///
17/// # Attributes
18///
19/// - `#[frame(column = "name")]` - Use a different column name than the field name
20/// - `#[frame(optional)]` - Field is optional; missing columns or None values become None
21/// - `#[frame(coerce)]` - Use widening type coercion for this field
22/// - `#[frame(skip)]` - Skip this field (must implement Default)
23#[proc_macro_derive(FromFrame, attributes(frame))]
24pub fn derive_from_frame(input: TokenStream) -> TokenStream {
25	derive_from_frame_with_crate(input.into(), "reifydb_client::value").into()
26}