1macro_rules! doc_ {
16 (@meta_start) => {
17 "<br/><i style='margin-left:0em;'></i><span style='font-size:90%;word-spacing:0px'>"
18 };
19 (@meta_start_nobr) => {
20 concat!(
21 "<i style='margin-left:0em;margin-top:-2em;'></i>",
22 "<span style='font-size:90%;word-spacing:0px'>",
23 )
24 };
25 (@meta_end) => { "</span>" };
26 (@meta_end_hr) => { "</span><hr/>" };
27 (newline) => { "<br/><br style='display:block;content:\"\";margin-top:10px;' />" };
29
30 ( modules: $path:path; $self:ident) => {
35 concat!(
36 $crate::doc_!(@meta_start),
37 "[", stringify!($self), "][mod@", stringify!($path), "::", stringify!($self), "]",
38 $crate::doc_!(@meta_end),
39 )
40 };
41 ( modules: $path:path; $self:ident: $($mod:ident),+ $(,)?) => {
43 concat!(
44 $crate::doc_!(@meta_start),
45 "[", stringify!($self), "][mod@", stringify!($path), "::", stringify!($self), "]::{",
46 $crate::doc_!(@modules: $path; $self: $($mod),+), "}",
47 $crate::doc_!(@meta_end),
48 )
49 };
50 (@modules: $path:path; $self:ident: $first:ident $(, $rest:ident)*) => {
52 concat!(
53 "[", stringify!($first), "](mod@",
54 stringify!($path), "::", stringify!($self), "::",
55 stringify!($first), ")",
56 $(
57 ", [", stringify!($rest), "](mod@", stringify!($path), "::",
58 stringify!($self), "::", stringify!($rest), ")"
59 ),*
60 )
61 };
62
63 (extends: $($mod:ident),+ $(,)?) => {
66 concat!(
67 $crate::doc_!(@meta_start_nobr), "Extends: ",
68 $crate::std_core!(), "::{", $crate::doc_!(@extends: $($mod),+), "}",
69 $crate::doc_!(@meta_end_hr),
70 )
71 };
72 (@extends: $first:ident $(, $rest:ident)*) => {
74 concat!(
75 "[", stringify!($first), "](mod@", $crate::std_core!(), "::", stringify!($first), ")",
76 $( ", [", stringify!($rest), "](mod@", $crate::std_core!(), "::", stringify!($rest), ")" ),*
77 )
78 };
79 (
80 vendor: $crate_id:literal) => { concat!(
84 "\n\n# Vendored\n\nThis is adapted work from [",
85 $crate_id, "][crate::_info::vendored#", $crate_id, "].\n\n"
86 )};
87 (
88 vendor: $crate_id:literal, module:$mod_id:ident) => { concat!(
90 "\n\n# Vendored\n\nThis is adapted work from [",
91 $crate_id, "][crate::_info::vendored::", $mod_id, "].\n\n"
92 )};
93 (
94 vendor_mod: $crate_id:literal, $mod_id:ident) => {
102 #[doc = concat!(
103 "# `", $crate_id,
104 "` modifications\n\n[*(↑)*][crate::_info::vendored#", $crate_id, "] ",
105 include_str!(concat!("./", $crate_id, ".md"))
106 )]
107 pub mod $mod_id {}
108 };
109 }
119pub(crate) use doc_;
120
121#[allow(unused_macros)]
130macro_rules! doc_availability {
131 (feature = $feat:literal) => {
132 $crate::doc_availability!{@wrap
133 "Available on <strong>crate feature ",
134 $crate::doc_availability!{@code $feat},
135 "</strong> only."
136 }
137 };
138
139 ( all( $(feature = $feat:literal),+ ) ) => {
141 $crate::doc_availability!{@wrap
142 "Available on <strong>crate features ",
143 $crate::doc_availability!{@join_features_and $($feat),+},
144 "</strong> only."
145 }
146 };
147 ( any( $(feature = $feat:literal),+ ) ) => {
149 $crate::doc_availability!{@wrap
150 "Available on <strong>crate features ",
151 $crate::doc_availability!{@join_features_or $($feat),+},
152 "</strong> only."
153 }
154 };
155
156 (@wrap $($strings:tt)+) => {
160 concat!(
161 "<div class='item-info' style='margin-left:0;'>",
162 "<div class='stab portability'>",
163 $($strings)+,
164 "</div></div>"
165 )
166 };
167
168 (@code $string:literal) => {
170 concat!("<code style='background:none'>", $string, "</code>")
171 };
172
173 (@join_features_and $first:literal $(, $rest:literal)*) => {
175 concat!(
176 $crate::doc_availability!{@code $first}
177 $(
178 , " and ", $crate::doc_availability!{@code $rest}
179 )*
180 )
181 };
182 (@join_features_or $first:literal $(, $rest:literal)*) => {
184 concat!(
185 $crate::doc_availability!{@code $first}
186 $(
187 , " or ", $crate::doc_availability!{@code $rest}
188 )*
189 )
190 };
191}
192#[allow(unused_imports)]
193pub(crate) use doc_availability;
194
195#[allow(unused_macros)]
197macro_rules! doc_miri_warn {
198 (tag) => {
199 concat!(
200 "<span class='stab portability' ",
201 "title='Fails to compile with Miri.'>",
202 "<code>⚠️</code></span>"
203 )
204 };
205 (body $(, url: $url:literal)?) => {
206 concat!(
207 "<div class='warning'>",
208 "Fails to compile with Miri.",
209 $( "<p><em>See <a href = '", $url, "'>", $url, "</a>.</em></p>", )?
210 "</div>"
211 )
212 };
213}
214#[allow(unused_imports)]
215pub(crate) use doc_miri_warn;
216
217#[cfg(feature = "std")]
219macro_rules! std_core {
220 () => {
221 "std"
222 };
223}
224#[cfg(not(feature = "std"))]
225macro_rules! std_core {
226 () => {
227 "core"
228 };
229}
230pub(crate) use std_core;
231
232mod tags {
234 #![allow(unused)]
235 crate::CONST! { pub(crate),
236 EMOJI_ATOMIC = "⚛️"; EMOJI_DATA_STRUCTURE = "📦"; EMOJI_ERROR = "🚩"; EMOJI_EXPERIMENTAL = "🧪";
241 EMOJI_NON_STANDARD = "⚠️";
242 EMOJI_ITERATOR = "🔄"; EMOJI_NAMESPACE = "🌐"; EMOJI_PRIMITIVE = "⚙️"; EMOJI_RESULT = "⚖️"; TAG_ATOMIC = concat!("<span class='stab portability' title='Atomic-related item'>",
248 crate::EMOJI_ATOMIC!(), "</span>");
249 TAG_DATA_STRUCTURE =
250 concat!("<span class='stab portability' title='A generic data structure'>",
251 crate::EMOJI_DATA_STRUCTURE!(), "</span>");
252 TAG_ERROR = concat!("<span class='stab portability' title='Individual error type'>",
253 crate::EMOJI_ERROR!(), "</span>");
254 TAG_ERROR_COMPOSITE =
255 concat!("<span class='stab portability' title='Composite error type'>",
256 crate::EMOJI_ERROR!(), "+</span>");
257 TAG_ITERATOR = concat!("<span class='stab portability' title='Iterator-related item'>",
258 crate::EMOJI_ITERATOR!(), "</span>");
259 TAG_NAMESPACE = concat!("<span class='stab portability' title='Namespaced functionality'>",
260 crate::EMOJI_NAMESPACE!(), "</span>");
261 TAG_PRIMITIVE = concat!("<span class='stab portability' title='Rust primitive'>",
262 crate::EMOJI_PRIMITIVE!(), "</span>");
263 TAG_RESULT = concat!("<span class='stab portability' title='Result type'>",
264 crate::EMOJI_RESULT!() ,"</span>");
265
266 TAG_EXPERIMENTAL = concat!(
267 "<span class='stab portability' title='Experimental functionality'>",
268 crate::EMOJI_EXPERIMENTAL!(), "</span>");
269 TAG_NON_STANDARD = concat!(
270 "<span class='stab portability' title='Non-standard. Expect poor cross-compatibility'>",
271 crate::EMOJI_NON_STANDARD!(), "</span>");
272
273 TAG_MAYBE_STD = "<span class='stab portability'
274 title='re-exported from rust's `std` or recreated if `not(std)`'>`?std`</span>";
275
276 TAG_ATOMIC_CORE_PORTABLE = concat!("<span class='stab portability' ",
280 "title='re-exported either from `core` or from the `portable-atomic` crate'>",
281 "`?core`</span>");
282 DOC_ATOMIC_CORE_PORTABLE = concat!("*Re-exported either from `core` or from the ",
283 "[`portable-atomic`](https://docs.rs/portable-atomic)* crate.\n\n---");
284
285 TAG_ATOMIC_ALLOC_PORTABLE_UTIL = concat!("<span class='stab portability' ",
287 "title='re-exported either from `alloc` or from the `portable-atomic-util` crate'>",
288 "`?alloc`</span>");
289 DOC_ATOMIC_ALLOC_PORTABLE_UTIL = concat!("*Re-exported either from `alloc` or from the ",
290 "[`portable-atomic-util`](https://docs.rs/portable-atomic-util)* crate.\n\n---");
291 }
292}
293pub(crate) use tags::*;