macro_schema_derive/lib.rs
1//! Procedural macro entry points for `macro-schema`.
2//!
3//! Depend on the `macro-schema` crate, not this one: it re-exports these macros
4//! as `macro_schema::define!` and `macro_schema::expand!`, with their
5//! documentation. Each macro here converts its input and errors and forwards to
6//! `macro-schema-core`.
7
8// The macros below carry no doc comments on purpose: rustdoc appends an item's own
9// docs to every re-export of it, so they would trail the facade's documentation.
10
11use proc_macro::TokenStream;
12
13#[proc_macro]
14pub fn define(input: TokenStream) -> TokenStream {
15 macro_schema_core::define(input.into())
16 .unwrap_or_else(|error| error.into_compile_error())
17 .into()
18}
19
20#[proc_macro]
21pub fn expand(input: TokenStream) -> TokenStream {
22 macro_schema_core::expand(input.into())
23 .unwrap_or_else(|error| error.into_compile_error())
24 .into()
25}