#[doc = crate::_tags!(code construction)]
#[doc = crate::_doc_location!("code/util")]
#[macro_export]
#[cfg_attr(cargo_primary_package, doc(hidden))]
macro_rules! _CONST {
(
// Either multiple `const fn`
$(
$(#[$CONST_ATTRS:meta])*
$item_vis:vis $CONST_NAME:ident =
$(#[$fn_attrs:meta])*
$fn_vis:vis const
$(async$($_a:block)?)? $(safe$($_s:block)?)? $(unsafe$($_u:block)?)?
fn $fn:ident($($param:ident: $param_ty:ty),* $(,)?)
$(-> $fn_return:ty)?
$fn_body:block
);* $(;)?) => {
$(
$(#[$CONST_ATTRS])*
#[allow(unused_macros)]
macro_rules! $CONST_NAME {
() => {
$(#[$fn_attrs])*
$fn_vis const $(async$($_a)?)? $(safe$($_s)?)? $(unsafe$($_u)?)?
fn $fn($($param: $param_ty),*) $(-> $fn_return)? $fn_body
}
}
#[allow(unused_imports)]
$item_vis use $CONST_NAME;
)*
};
(
$shared_vis:vis, $(
$(#[$CONST_ATTRS:meta])*
$CONST_NAME:ident =
$(#[$fn_attrs:meta])*
$fn_vis:vis const
$(async$($_a:block)?)? $(safe$($_s:block)?)? $(unsafe$($_u:block)?)?
fn $fn:ident($($param:ident: $param_ty:ty),* $(,)?)
$(-> $fn_return:ty)?
$fn_body:block
);* $(;)?) => {
$(
$(#[$CONST_ATTRS])*
#[allow(unused_macros)]
macro_rules! $CONST_NAME {
() => {
$(#[$fn_attrs])*
$shared_vis const $(async$($_a)?)? $(safe$($_s)?)? $(unsafe$($_u)?)?
fn $fn($($param: $param_ty),*) $(-> $fn_return)? $fn_body
}
}
#[allow(unused_imports)]
$shared_vis use $CONST_NAME;
)*
};
(
$(
$(#[$CONST_ATTRS:meta])*
$item_vis:vis $CONST_NAME:ident = $expr:expr
);* $(;)?) => {
$(
$(#[$CONST_ATTRS])*
#[allow(unused_macro)]
macro_rules! $CONST_NAME { () => { $expr } }
#[allow(unused_imports)]
$item_vis use $CONST_NAME;
)*
};
(
$shared_vis:vis, $(
$(#[$CONST_ATTRS:meta])*
$CONST_NAME:ident = $expr:expr
);* $(;)?) => {
$(
$(#[$CONST_ATTRS])*
#[allow(unused_macro)]
macro_rules! $CONST_NAME { () => { $expr } }
#[allow(unused_imports)]
$shared_vis use $CONST_NAME;
)*
};
(
hidden macro_export,
$(
$(#[$CONST_ATTRS:meta])*
$CONST_NAME:ident = $expr:expr
);* $(;)?) => { $crate::paste! {
$(
$(#[$CONST_ATTRS])*
#[allow(unused_macro)]
#[macro_export]
#[doc(hidden)]
macro_rules! [< _ $CONST_NAME >] { () => { $expr } }
#[doc(hidden)]
#[allow(unused_imports)]
pub use [< _ $CONST_NAME >] as $CONST_NAME;
)*
}};
(
inline macro_export,
$(
$(#[$CONST_ATTRS:meta])*
$CONST_NAME:ident = $expr:expr
);* $(;)?) => { $crate::paste! {
$(
$(#[$CONST_ATTRS])*
#[allow(unused_macro)]
#[macro_export]
#[cfg_attr(cargo_primary_package, doc(hidden))]
macro_rules! [< _ $CONST_NAME >] { () => { $expr } }
#[doc(inline)]
#[allow(unused_imports)]
pub use [< _ $CONST_NAME >] as $CONST_NAME;
)*
}};
}
#[doc(inline)]
pub use _CONST as CONST;