reifydb_macro_impl/
lib.rs

1// Copyright (c) reifydb.com 2025
2// This file is licensed under the MIT, see license.md file
3
4//! Implementation for ReifyDB derive macros.
5//!
6//! This crate provides the implementation logic used by proc-macro crates.
7//! It's not intended for direct use - use `reifydb-macro`, `reifydb-derive`,
8//! or `reifydb-client-derive` instead.
9
10pub mod from_frame;
11pub mod generate;
12pub mod parse;
13
14use proc_macro2::TokenStream;
15
16/// Derive `FromFrame` with the default crate path (reifydb_type).
17pub fn derive_from_frame(input: TokenStream) -> TokenStream {
18	derive_from_frame_with_crate(input, "reifydb_type")
19}
20
21/// Derive `FromFrame` with a custom crate path.
22///
23/// # Arguments
24/// * `input` - The derive macro input TokenStream
25/// * `crate_path` - The crate path to use (e.g., "reifydb", "reifydb_client", "reifydb_type")
26pub fn derive_from_frame_with_crate(input: TokenStream, crate_path: &str) -> TokenStream {
27	match parse::parse_struct_with_crate(input, crate_path) {
28		Ok(parsed) => from_frame::expand(parsed),
29		Err(err) => err,
30	}
31}