| 1 | //! Derive macro for daft (internal crate). |
| 2 | //! |
| 3 | //! For more information about daft, see [its documentation](https://docs.rs/daft). |
| 4 | // Setting html_root_url allows daft's readme to have links to daft-derive. This |
| 5 | // line is updated by cargo-release. |
| 6 | #![doc(html_root_url = "https://docs.rs/daft-derive/0.1.5")] |
| 7 | mod internals; |
| 8 | |
| 9 | use quote::ToTokens; |
| 10 | use syn::parse_macro_input; |
| 11 | |
| 12 | // NOTE: We do not define documentation here -- only in daft while re-exporting |
| 13 | // these items. This is so that doctests that depend on daft work. |
| 14 | |
| 15 | #[proc_macro_derive(Diffable, attributes(daft))] |
| 16 | pub fn derive_diffable( |
| 17 | input: proc_macro::TokenStream, |
| 18 | ) -> proc_macro::TokenStream { |
| 19 | let input = parse_macro_input!(input as syn::DeriveInput); |
| 20 | internals::derive_diffable(input).into_token_stream().into() |
| 21 | } |