#[doc(hidden)]
#[macro_export]
macro_rules! __extract_and_apply_cfg_attributes {
{
@() @($($output:tt)*)
} => {
$($output)*
};
{
@(
#[cfg $($args:tt)*]
$($m_rest:tt)*
)
@($($output:tt)*)
} => {
#[cfg $($args)*]
{
$crate::__extract_and_apply_cfg_attributes! {
@($($m_rest)*)
@($($output)*)
}
}
};
{
@(
#[$($m_ignored:tt)*]
$($m_rest:tt)*
)
@($($output:tt)*)
} => {
$crate::__extract_and_apply_cfg_attributes! {
@($($m_rest)*)
@($($output)*)
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __extract_custom_attributes {
{
($($m:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($m)*)
()
()
()
($name)
($out_macro)
$($macro_args)*
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __extract_custom_attributes_inner {
{
()
()
($($m_optional:tt)*)
($($m_checked:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
fn $name() {
compile_error!("must specify the desired selector using `#[method(...)]` or `#[method_id(...)]`")
}
};
{
()
($($m_method:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
($($m_method)*)
($($m_optional)*)
($($m_checked)*)
}
};
{
(
#[method($($args:tt)*)]
$($rest:tt)*
)
()
($($m_optional:tt)*)
($($m_checked:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($rest)*)
(#[method($($args)*)])
($($m_optional)*)
($($m_checked)*)
($name)
($out_macro)
$($macro_args)*
}
};
{
(
#[method($($args:tt)*)]
$($rest:tt)*
)
($($m_method:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
fn $name() {
compile_error!("cannot specify the `method`/`method_id` attribute twice")
}
};
{
(
#[method_id($($args:tt)*)]
$($rest:tt)*
)
()
($($m_optional:tt)*)
($($m_checked:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($rest)*)
(#[method_id($($args)*)])
($($m_optional)*)
($($m_checked)*)
($name)
($out_macro)
$($macro_args)*
}
};
{
(
#[method_id($($args:tt)*)]
$($rest:tt)*
)
($($m_method:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
fn $name() {
compile_error!("cannot specify the `method`/`method_id` attribute twice")
}
};
{
(
#[optional]
$($rest:tt)*
)
($($m_method:tt)*)
()
($($m_checked:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($rest)*)
($($m_method)*)
(#[optional])
($($m_checked)*)
($name)
($out_macro)
$($macro_args)*
}
};
{
(
#[optional]
$($rest:tt)*
)
($($m_method:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
fn $name() {
compile_error!("cannot specify the `optional` attribute twice")
}
};
{
(
#[$($checked:tt)*]
$($rest:tt)*
)
($($m_method:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($name:ident)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($rest)*)
($($m_method)*)
($($m_optional)*)
(
$($m_checked)*
#[$($checked)*]
)
($name)
($out_macro)
$($macro_args)*
}
};
}