#[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)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($m)*)
() () () ()
($out_macro)
$($macro_args)*
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __extract_custom_attributes_inner {
{
()
()
($($retain_semantics:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__macro_helpers::compile_error!("must specify the desired selector using `#[method(...)]` or `#[method_id(...)]`");
};
{
()
($($m_method:tt)*)
($($retain_semantics:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
($($m_method)*)
($($retain_semantics)*)
($($m_optional)*)
($($m_checked)*)
}
};
{
(
#[method($($sel:tt)*)]
$($rest:tt)*
)
()
($($retain_semantics:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($rest)*)
(#[method($($sel)*)])
($($retain_semantics)*)
($($m_optional)*)
($($m_checked)*)
($out_macro)
$($macro_args)*
}
};
{
(
#[method($($sel:tt)*)]
$($rest:tt)*
)
($($m_method:tt)*)
($($retain_semantics:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__macro_helpers::compile_error!("cannot specify the `method`/`method_id` attribute twice");
};
{
(
#[method_id(@__retain_semantics $retain_semantics:ident $($sel:tt)*)]
$($rest:tt)*
)
()
()
($($m_optional:tt)*)
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($rest)*)
(#[method_id($($sel)*)])
($retain_semantics)
($($m_optional)*)
($($m_checked)*)
($out_macro)
$($macro_args)*
}
};
{
(
#[method_id($($sel:tt)*)]
$($rest:tt)*
)
()
($($retain_semantics:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($rest)*)
(#[method_id($($sel)*)])
($($retain_semantics)*)
($($m_optional)*)
($($m_checked)*)
($out_macro)
$($macro_args)*
}
};
{
(
#[method_id($($sel:tt)*)]
$($rest:tt)*
)
($($m_method:tt)*)
($($retain_semantics:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__macro_helpers::compile_error!("cannot specify the `method`/`method_id` attribute twice");
};
{
(
#[optional]
$($rest:tt)*
)
($($m_method:tt)*)
($($retain_semantics:tt)*)
()
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($rest)*)
($($m_method)*)
($($retain_semantics)*)
(#[optional])
($($m_checked)*)
($out_macro)
$($macro_args)*
}
};
{
(
#[optional]
$($rest:tt)*
)
($($m_method:tt)*)
($($retain_semantics:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__macro_helpers::compile_error!("cannot specify the `optional` attribute twice");
};
{
(
#[$($checked:tt)*]
$($rest:tt)*
)
($($m_method:tt)*)
($($retain_semantics:tt)*)
($($m_optional:tt)*)
($($m_checked:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__extract_custom_attributes_inner! {
($($rest)*)
($($m_method)*)
($($retain_semantics)*)
($($m_optional)*)
(
$($m_checked)*
#[$($checked)*]
)
($out_macro)
$($macro_args)*
}
};
}