Skip to main content

fack_codegen/
lib.rs

1//! Code generation engine for the `fack` derive language.
2//!
3//! The public API keeps compiler representations opaque while exposing the
4//! parse, validate, and expansion stages required by downstream tooling.
5#![no_std]
6#![forbid(unsafe_code, missing_docs, rustdoc::all)]
7
8extern crate alloc;
9
10mod binding;
11mod bounds;
12mod diagnostic;
13mod enumerate;
14mod expand;
15mod field;
16mod format;
17mod resolve;
18mod semantics;
19mod source;
20mod structure;
21mod syntax;
22mod target;
23mod validate;
24
25pub use target::Target;
26pub use validate::ValidatedTarget;
27
28/// Parse, validate, and expand one derive input.
29///
30/// # Errors
31///
32/// Returns the first syntax, semantic, or expansion diagnostic produced by the
33/// engine.
34#[inline]
35pub fn generate(input: &syn::DeriveInput) -> syn::Result<proc_macro2::TokenStream> {
36    Target::input(input)?.validate()?.expand()
37}