/// Helper macro to implement the necessary traits for function reflection.1///2/// This macro calls the following macros:3/// - [`impl_get_ownership`](crate::func::args::impl_get_ownership)4/// - [`impl_from_arg`](crate::func::args::impl_from_arg)5/// - [`impl_into_return`](crate::func::impl_into_return)6///7/// # Syntax8///9/// For non-generic types, the macro simply expects the type:10///11/// ```ignore12/// impl_function_traits!(foo::bar::Baz);13/// ```14///15/// For generic types, however, the generic type parameters must also be given in angle brackets (`<` and `>`):16///17/// ```ignore18/// impl_function_traits!(foo::bar::Baz<T, U>; <T: Clone, U>);19/// ```20///21/// For generic const parameters, they must be given in square brackets (`[` and `]`):22///23/// ```ignore24/// impl_function_traits!(foo::bar::Baz<T, N>; <T> [const N: usize]);25/// ```26macro_rules! impl_function_traits {27(28$ty: ty29$(;30< $($T: ident $(: $T1: tt $(+ $T2: tt)*)?),* >31)?32$(33[ $(const $N: ident : $size: ident),* ]34)?35$(36where $($U: ty $(: $U1: tt $(+ $U2: tt)*)?),*37)?38) => {39$crate::func::args::impl_get_ownership!(40$ty41$(;42< $($T $(: $T1 $(+ $T2)*)?),* >43)?44$(45[ $(const $N : $size),* ]46)?47$(48where $($U $(: $U1 $(+ $U2)*)?),*49)?50);51$crate::func::args::impl_from_arg!(52$ty53$(;54< $($T $(: $T1 $(+ $T2)*)?),* >55)?56$(57[ $(const $N : $size),* ]58)?59$(60where $($U $(: $U1 $(+ $U2)*)?),*61)?62);63$crate::func::impl_into_return!(64$ty65$(;66< $($T $(: $T1 $(+ $T2)*)?),* >67)?68$(69[ $(const $N : $size),* ]70)?71$(72where $($U $(: $U1 $(+ $U2)*)?),*73)?74);75};76}7778pub(crate) use impl_function_traits;7980/// Helper macro that returns the number of tokens it receives.81///82/// See [here] for details.83///84/// [here]: https://veykril.github.io/tlborm/decl-macros/building-blocks/counting.html#bit-twiddling85macro_rules! count_tokens {86() => { 0 };87($odd:tt $($a:tt $b:tt)*) => { ($crate::func::macros::count_tokens!($($a)*) << 1) | 1 };88($($a:tt $even:tt)*) => { $crate::func::macros::count_tokens!($($a)*) << 1 };89}9091pub(crate) use count_tokens;929394