Skip to main content

reifydb_macro_impl/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4//! Implementation crate for ReifyDB derive macros. Holds the parsing, validation, and codegen for `FromFrame` (and
5//! the family of related derives) so the public proc-macro crates - `reifydb-macro`, `reifydb-derive`, the future
6//! `reifydb-client-derive` - can re-export a single shared expansion. Application code never depends on this crate
7//! directly; depending on it creates a proc-macro dependency that the public crates already satisfy.
8
9#![cfg_attr(not(debug_assertions), deny(clippy::disallowed_methods))]
10#![cfg_attr(debug_assertions, warn(clippy::disallowed_methods))]
11#![cfg_attr(not(debug_assertions), deny(warnings))]
12#![allow(clippy::tabs_in_doc_comments)]
13
14pub mod from_frame;
15pub mod generate;
16pub mod parse;
17
18use proc_macro2::TokenStream;
19
20pub fn derive_from_frame(input: TokenStream) -> TokenStream {
21	derive_from_frame_with_crate(input, "reifydb_value")
22}
23
24pub fn derive_from_frame_with_crate(input: TokenStream, crate_path: &str) -> TokenStream {
25	match parse::parse_struct_with_crate(input, crate_path) {
26		Ok(parsed) => from_frame::expand(parsed),
27		Err(err) => err,
28	}
29}