#![deny(warnings)]
#![doc(test(attr(deny(warnings))))]
#![doc(test(attr(allow(dead_code))))]
#![doc(test(attr(allow(unused_variables))))]
#![doc(test(attr(allow(unused_macros))))]
#![doc(test(attr(allow(unknown_lints, unused_macro_rules))))]
#![no_std]
#[doc=include_str!("../README.md")]
type _DocTestReadme = ();
#[macro_export]
macro_rules! macro_attr {
(
$(#[$($attrs:tt)+])*
$(pub $(($($vis:tt)+))?)? enum $($it:tt)+
) => {
$crate::macro_attr_impl! {
@split_attrs [$(pub $(($($vis)+))?)? enum $($it)+]
[] []
[$([$($attrs)+])*]
}
};
(
$(#[$($attrs:tt)+])*
$(pub $(($($vis:tt)+))?)? struct $($it:tt)+
) => {
$crate::macro_attr_impl! {
@split_attrs [$(pub $(($($vis)+))?)? struct $($it)+]
[] []
[$([$($attrs)+])*]
}
};
(
$(#[$($attrs:tt)+])*
$(pub $(($($vis:tt)+))?)? trait $($it:tt)+
) => {
$crate::macro_attr_impl! {
@split_attrs [$(pub ($($vis)+))? trait $($it)+]
[] []
[$([$($attrs)+])*]
}
};
(
$(#[$($attrs:tt)+])*
$vis:vis $keyword:ident $($it:tt)+
) => {
$crate::macro_attr_impl! {
@split_attrs [$vis $keyword $($it)+]
[] []
[$([$($attrs)+])*]
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! macro_attr_impl {
(
@split_attrs [$($it:tt)+]
[$($derive_attrs:tt)*] [$([$other_attrs:meta])*]
[[derive($($derive_attr:tt)+)] $([$($attrs:tt)+])*]
) => {
$crate::macro_attr_impl! {
@split_attrs [$($it)+]
[$($derive_attrs)* [$($derive_attr)+]]
[$([$other_attrs])*]
[$([$($attrs)+])*]
}
};
(
@split_attrs [$($it:tt)+]
[$($derive_attrs:tt)*] [$([$other_attrs:meta])*]
[[$attr:meta] $([$($attrs:tt)+])*]
) => {
$crate::macro_attr_impl! {
@split_attrs [$($it)+]
[$($derive_attrs)*]
[$([$other_attrs])* [$attr]]
[$([$($attrs)+])*]
}
};
(
@split_attrs [$($it:tt)+]
[$($derive_attrs:tt)*] [$([$other_attrs:meta])*]
[]
) => {
$crate::macro_attr_impl! {
@split_derive_attrs [$($it)+] [$([$other_attrs])*]
[] []
[$($derive_attrs)*]
}
};
(
@split_derive_attrs [$($it:tt)+] [$([$other_attrs:meta])*]
[$($macro_derives:tt)*] [$($std_derives:tt)*]
[
[$macro_derive:ident ! $(($($macro_derive_args:tt)*))? $(, $($other_inner_derives:tt)*)?]
$([$($other_derives:tt)*])*
]
) => {
$crate::macro_attr_impl! {
@split_derive_attrs [$($it)+] [$([$other_attrs])*]
[
$($macro_derives)*
[$macro_derive ( $($($macro_derive_args)*)? )]
]
[
$($std_derives)*
]
[
$([$($other_inner_derives)*])?
$([$($other_derives)*])*
]
}
};
(
@split_derive_attrs [$($it:tt)+] [$([$other_attrs:meta])*]
[$($macro_derives:tt)*] [$($std_derives:tt)*]
[
[$std_derive:ident $(($($std_derive_args:tt)*))? $(, $($other_inner_derives:tt)*)?]
$([$($other_derives:tt)*])*
]
) => {
$crate::macro_attr_impl! {
@split_derive_attrs [$($it)+] [$([$other_attrs])*]
[
$($macro_derives)*
]
[
$($std_derives)*
#[derive($std_derive $(($($std_derive_args)*))?)]
]
[
$([$($other_inner_derives)*])?
$([$($other_derives)*])*
]
}
};
(
@split_derive_attrs [$($it:tt)+] [$([$other_attrs:meta])*]
[$($macro_derives:tt)*] [$($std_derives:tt)*]
[
[]
$([$($other_derives:tt)*])*
]
) => {
$crate::macro_attr_impl! {
@split_derive_attrs [$($it)+] [$([$other_attrs])*]
[
$($macro_derives)*
]
[
$($std_derives)*
]
[
$([$($other_derives)*])*
]
}
};
(
@split_derive_attrs [$($it:tt)+] [$([$other_attrs:meta])*]
[$([$macro_derive:ident ( $($macro_derive_args:tt)* )])*]
[$($std_derives:tt)*]
[]
) => {
$crate::macro_attr_impl! {
@as_item
$($std_derives)*
$(#[$other_attrs])*
$($it)+
}
$crate::macro_attr_impl! {
@expand [$($it)+]
[$([$macro_derive ( $($macro_derive_args)* )])*]
}
};
(
@expand [$($it:tt)+]
[
[$macro_derive:ident ( $($macro_derive_args:tt)* )]
$([$other_macro_derives:ident ( $($other_macro_derives_args:tt)* )])*
]
) => {
$macro_derive! {
( $($macro_derive_args)* )
$($it)+
}
$crate::macro_attr_impl! {
@expand [$($it)+]
[$([$other_macro_derives ( $($other_macro_derives_args)* )])*]
}
};
(
@expand [$($it:tt)+]
[]
) => {
};
(@as_item $($i:item)*) => {$($i)*};
}