proc-macro-api

Crates.ioproc-macro-api
lib.rsproc-macro-api
version0.1.5
created_at2025-04-22 09:58:18.48724+00
updated_at2025-05-09 04:36:06.200079+00
descriptionA macro helping with exporting APIs in a proc-macro library crate.
homepage
repositoryhttps://github.com/BoxCatGarden/proc_macro_api
max_upload_size
id1643774
size33,298
(BoxCatGarden)

documentation

README

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.

Commit count: 176

cargo fmt