macro_rules! doc_ {
(@meta_start) => {
"<br/><i style='margin-left:0em;'></i><span style='font-size:90%;word-spacing:0px'>"
};
(@meta_start_nobr) => {
concat!(
"<i style='margin-left:0em;margin-top:-2em;'></i>",
"<span style='font-size:90%;word-spacing:0px'>",
)
};
(@meta_end) => { "</span>" };
(@meta_end_hr) => { "</span><hr/>" };
(newline) => { "<br/><br style='display:block;content:\"\";margin-top:10px;' />" };
(modules: $path:path; $self:ident) => {
concat!(
$crate::doc_!(@meta_start),
"[", stringify!($self), "][mod@", stringify!($path), "::", stringify!($self), "]",
$crate::doc_!(@meta_end),
)
};
(modules: $path:path; $self:ident: $($mod:ident),+ $(,)?) => {
concat!(
$crate::doc_!(@meta_start),
"[", stringify!($self), "][mod@", stringify!($path), "::", stringify!($self), "]::{",
$crate::doc_!(@modules: $path; $self: $($mod),+), "}",
$crate::doc_!(@meta_end),
)
};
(@modules: $path:path; $self:ident: $first:ident $(, $rest:ident)*) => {
concat!(
"[", stringify!($first), "](",
stringify!($path), "::", stringify!($self), "::",
stringify!($first), ")",
$(
", [", stringify!($rest), "](", stringify!($path), "::",
stringify!($self), "::", stringify!($rest), ")"
),*
)
};
(extends: $($mod:ident),+ $(,)?) => {
concat!(
$crate::doc_!(@meta_start_nobr), "Extends: ",
$crate::std_core!(), "::{", $crate::doc_!(@extends: $($mod),+), "}",
$crate::doc_!(@meta_end_hr),
)
};
(@extends: $first:ident $(, $rest:ident)*) => {
concat!(
"[", stringify!($first), "](mod@", $crate::std_core!(), "::", stringify!($first), ")",
$( ", [", stringify!($rest), "](mod@", $crate::std_core!(), "::", stringify!($rest), ")" ),*
)
};
}
pub(crate) use doc_;
#[allow(unused_macros)]
macro_rules! doc_availability {
(feature = $feat:literal) => {
$crate::doc_availability!{@wrap
"Available on <strong>crate feature ",
$crate::doc_availability!{@code $feat},
"</strong> only."
}
};
( all( $(feature = $feat:literal),+ ) ) => {
$crate::doc_availability!{@wrap
"Available on <strong>crate features ",
$crate::doc_availability!{@join_features_and $($feat),+},
"</strong> only."
}
};
( any( $(feature = $feat:literal),+ ) ) => {
$crate::doc_availability!{@wrap
"Available on <strong>crate features ",
$crate::doc_availability!{@join_features_or $($feat),+},
"</strong> only."
}
};
(@wrap $($strings:tt)+) => {
concat!(
"<div class='item-info' style='margin-left:0;'>",
"<div class='stab portability'>",
$($strings)+,
"</div></div>"
)
};
(@code $string:literal) => {
concat!("<code style='background:none'>", $string, "</code>")
};
(@join_features_and $first:literal $(, $rest:literal)*) => {
concat!(
$crate::doc_availability!{@code $first}
$(
, " and ", $crate::doc_availability!{@code $rest}
)*
)
};
(@join_features_or $first:literal $(, $rest:literal)*) => {
concat!(
$crate::doc_availability!{@code $first}
$(
, " or ", $crate::doc_availability!{@code $rest}
)*
)
};
}
#[allow(unused_imports)]
pub(crate) use doc_availability;
#[allow(unused_macros)]
macro_rules! doc_miri_warn {
(tag) => {
concat!(
"<span class='stab portability' ",
"title='Fails to compile with Miri.'>",
"<code>⚠️</code></span>"
)
};
(body $(, url: $url:literal)?) => {
concat!(
"<div class='warning'>",
"Fails to compile with Miri.",
$( "<p><em>See <a href = '", $url, "'>", $url, "</a>.</em></p>", )?
"</div>"
)
};
}
#[allow(unused_imports)]
pub(crate) use doc_miri_warn;
#[cfg(feature = "std")]
macro_rules! std_core {
() => {
"std"
};
}
#[cfg(not(feature = "std"))]
macro_rules! std_core {
() => {
"core"
};
}
pub(crate) use std_core;
crate::CONST! { pub(crate),
EMOJI_ATOMIC = "⚛️"; EMOJI_ERROR = "🚩"; EMOJI_ITERATOR = "🔄"; EMOJI_PRIMITIVE = "⚙️"; EMOJI_RESULT = "⚖️"; TAG_ATOMIC = concat!("<span class='stab portability' title='Atomic type'>",
crate::EMOJI_ATOMIC!(), "</span>");
TAG_ERROR = concat!("<span class='stab portability' title='Individual error type'>",
crate::EMOJI_ERROR!(), "</span>");
TAG_ERROR_COMPOSITE =
concat!("<span class='stab portability' title='Composite error type'>",
crate::EMOJI_ERROR!(), "+</span>");
TAG_ITERATOR = concat!("<span class='stab portability' title='Iterator type'>",
crate::EMOJI_ITERATOR!(), "</span>");
TAG_PRIMITIVE = concat!("<span class='stab portability' title='Rust primitive'>",
crate::EMOJI_PRIMITIVE!(), "</span>");
TAG_RESULT = concat!("<span class='stab portability' title='Result type'>",
crate::EMOJI_RESULT!() ,"</span>");
}