Skip to content

Commit

Permalink
Support custom attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
CreepySkeleton authored and mystor committed Nov 5, 2019
1 parent 8d36456 commit e357682
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ pub use syn::{parse, parse_str, DeriveInput};
#[macro_export]
macro_rules! decl_derive {
// XXX: Switch to using this variant everywhere?
([$derives:ident $($derive_t:tt)*] => $inner:path) => {
([$derives:ident $($derive_t:tt)*] => $(#[$attrs:meta])* $inner:path) => {
#[proc_macro_derive($derives $($derive_t)*)]
#[allow(non_snake_case)]
$(#[$attrs])*
pub fn $derives(
i: $crate::macros::TokenStream
) -> $crate::macros::TokenStream {
Expand Down Expand Up @@ -104,8 +105,9 @@ macro_rules! decl_derive {
/// ```
#[macro_export]
macro_rules! decl_attribute {
([$attribute:ident] => $inner:path) => {
([$attribute:ident] => $(#[$attrs:meta])* $inner:path) => {
#[proc_macro_attribute]
$(#[$attrs])*
pub fn $attribute(
attr: $crate::macros::TokenStream,
i: $crate::macros::TokenStream,
Expand Down

0 comments on commit e357682

Please sign in to comment.