#proc-macro #macro-export #module #proc-macro-export

no-std proc-macro-api

A macro helping with exporting APIs in a proc-macro library crate

5 releases

Uses new Rust 2024

new 0.1.4 May 6, 2025
0.1.3 Apr 26, 2025
0.1.2 Apr 22, 2025
0.1.1 Apr 22, 2025
0.1.0 Apr 22, 2025

#272 in Procedural macros

Download history 276/week @ 2025-04-22 18/week @ 2025-04-29

294 downloads per month
Used in proc-macro-api-tests

MIT/Apache

21KB
546 lines

A crate helping with structuring the library crate of a proc-macro package.

The major of this crate is macro proc_macro_api!, which can export functions in submodules of a proc-macro crate as the Application Programing Interfaces (APIs) of that proc-macro crate.

For example, assuming sub is a submodule of the root of a proc-macro crate and has a function, pub fn proc_fn(input: TokenStream) -> TokenStream, in order to export proc_fn as a function-like macro, proc_macro_api! can be used in the root of the crate like:

proc_macro_api! {
    sub::{
        #[proc_macro]
        proc_fn,
    },
}

Then, a function-like macro, proc_fn!(), is available from that proc-macro crate.

Note: See the crate documentation for more details.

No runtime deps

Features