#[doc = crate::_tags!(internal assert mem)]
#[doc = crate::_doc_meta!{location("yard")}]
#[cfg_attr(cargo_primary_package, doc(hidden))]
#[cfg_attr(not(feature = "__docs_internal"), doc(hidden))]
#[cfg_attr(nightly_doc, doc(cfg(feature = "__docs_internal")))]
#[macro_export]
macro_rules! _doc_test_size_of· {
($(#[$meta:meta])* $ty:ty = $bytes:literal $(| $bits:literal)? $(; niche $wrap:ident)? $(,)?) => {
$crate::_doc_test_size_of!(@doc [$(#[$meta])*] [$($wrap)?]
stringify!($ty),
concat!("devela::", stringify!($ty)),
stringify!($ty),
stringify!($bytes)
$(, stringify!($bits))?
)
};
($(#[$meta:meta])* $name:ident : $ty:ty = $bytes:literal $(| $bits:literal)? $(; niche $wrap:ident)? $(,)?) => {
$crate::_doc_test_size_of!(@doc [$(#[$meta])*] [$($wrap)?]
stringify!($name), concat!("devela::", stringify!($ty)),
stringify!($ty), stringify!($bytes) $(, stringify!($bits))?
)
};
($(#[$meta:meta])* abs $name:ident : $ty:ty = $bytes:literal $(| $bits:literal)? $(; niche $wrap:ident)? $(,)?) => {
$crate::_doc_test_size_of!(@doc [$(#[$meta])*] [$($wrap)?]
stringify!($name), stringify!($ty), stringify!($ty), stringify!($bytes) $(, stringify!($bits))?
)
};
(@doc [$(#[$meta:meta])*] [$($wrap:ident)?]
$label:expr, $test_ty:expr, $shown_ty:expr, $bytes:expr $(, $bits:expr)?
) => {
concat!(
"\n\n",
"<sup class='_doc_test_size_of' title='stack size, checked by hidden doctest'>",
"📦 `size_of::<", $shown_ty, ">() == ", $bytes, "` bytes",
$(" / ", $bits, " bits",)?
$crate::_doc_test_size_of!(@meta $(#[$meta])*),
"</sup>",
$crate::_doc_test_size_of!(@niche_doc [$($wrap)?]),
"\n\n",
"<div hidden class='devela-hide-next'></div>\n\n",
"```rust\n",
$( "# ", stringify!(#[$meta]), "\n", )*
"# devela::test_size_of!(assert ", $test_ty, " = ", $bytes,
$("|", $bits,)?
$crate::_doc_test_size_of!(@niche_test [$($wrap)?]),
");\n",
"```\n",
)
};
(@niche_doc []) => { "" };
(@niche_doc [Option]) => {
concat!("\n", "<sup class='_doc_niche' ",
"title='checked by hidden doctest: Option<T> has the same stack size as T'>",
"⚗️`Option<T>`", "</sup>"
)
};
(@niche_test []) => { "" };
(@niche_test [Option]) => { "; niche Option" };
(@meta) => { "" };
(@meta $(#[$meta:meta])+) => {
concat!(" #️⃣ ", $(stringify!(#[$meta]), " ",)+)
};
}
#[doc(inline)]
pub use _doc_test_size_of· as _doc_test_size_of;