1 //! The point of this crate is to be able to have enough different "kinds" of
2 //! documentation generated so we can test each different features.
3 #![doc(html_playground_url="https://play.rust-lang.org/")]
5 #![crate_name = "test_docs"]
6 #![feature(rustdoc_internals)]
8 #![feature(associated_type_defaults)]
11 Enable the feature <span class="stab portability"><code>some-feature</code></span> to enjoy
13 Enable the feature <span class="stab portability"><code>some-feature</code></span> to enjoy
15 Enable the feature <span class="stab portability"><code>some-feature</code></span> to enjoy
18 Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
19 Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
20 Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
22 Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
24 Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
28 use std::convert::AsRef;
31 /// Basic function with some code examples:
34 /// println!("nothing fancy");
35 /// println!("but with two lines!");
38 /// A failing to compile one:
41 /// println!("where did my argument {} go? :'(");
46 /// ```ignore (it's a test)
47 /// Let's say I'm just some text will ya?
50 /// A failing to run one:
56 /// An inlined `code`!
59 /// Just a normal struct.
64 pub fn must_use(&self) -> bool {
69 impl AsRef<str> for Foo {
70 fn as_ref(&self) -> &str {
75 /// Just a normal enum.
78 #[doc(alias = "ThisIsAnAlias")]
80 pub enum WhoLetTheDogOut {
87 /// Who doesn't love to wrap a `format!` call?
88 pub fn some_more_function<T: fmt::Debug>(t: &T) -> String {
93 pub trait AnotherOne {
113 /// Check for "i" signs in lists!
121 /// 4. ```ignore (it's a test)
128 /// ```ignore (still a test)
131 pub fn check_list_code_block() {}
133 /// a thing with a label
134 #[deprecated(since = "1.0.0", note = "text why this deprecated")]
136 pub fn replaced_function() {}
138 /// Some doc with `code`!
140 WithVariants { and: usize, sub: usize, variants: usize },
143 #[doc(keyword = "CookieMonster")]
147 /// Just some type alias.
148 pub type SomeType = u32;
150 pub mod huge_amount_of_consts {
151 include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
154 /// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
155 pub mod long_code_block {}
157 /// Very long code text [`hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`][lnk].
159 /// [lnk]: crate::long_code_block_link
160 pub mod long_code_block_link {}
167 pub use crate::repro as repro2;
169 /// # Top-doc Prose title
171 /// Text below title.
173 /// ## Top-doc Prose sub-heading
175 /// Text below sub-heading.
177 /// ### Top-doc Prose sub-sub-heading
179 /// Text below sub-sub-heading
181 /// #### You know the drill.
184 pub struct HeavilyDocumentedStruct {
185 /// # Title for field
186 /// ## Sub-heading for field
190 /// # Title for struct impl doc
192 /// Text below heading.
194 /// ## Sub-heading for struct impl doc
196 /// Text below sub-heading.
198 /// ### Sub-sub-heading for struct impl doc
200 /// Text below sub-sub-heading.
202 impl HeavilyDocumentedStruct {
203 /// # Title for struct impl-item doc
204 /// Text below title.
205 /// ## Sub-heading for struct impl-item doc
206 /// Text below sub-heading.
207 /// ### Sub-sub-heading for struct impl-item doc
208 /// Text below sub-sub-heading.
209 pub fn do_nothing() {}
212 /// # Top-doc Prose title
214 /// Text below title.
216 /// ## Top-doc Prose sub-heading
218 /// Text below sub-heading.
220 /// ### Top-doc Prose sub-sub-heading
222 /// Text below sub-sub-heading
223 pub enum HeavilyDocumentedEnum {
224 /// # None prose title
225 /// ## None prose sub-heading
227 /// # Wrapped prose title
228 /// ## Wrapped prose sub-heading
230 /// # Wrapped.0 prose title
231 /// ## Wrapped.0 prose sub-heading
236 /// # Structy prose title
237 /// ## Structy prose sub-heading
243 /// # Title for enum impl doc
245 /// Text below heading.
247 /// ## Sub-heading for enum impl doc
249 /// Text below sub-heading.
251 /// ### Sub-sub-heading for enum impl doc
253 /// Text below sub-sub-heading.
255 impl HeavilyDocumentedEnum {
256 /// # Title for enum impl-item doc
257 /// Text below title.
258 /// ## Sub-heading for enum impl-item doc
259 /// Text below sub-heading.
260 /// ### Sub-sub-heading for enum impl-item doc
261 /// Text below sub-sub-heading.
262 pub fn do_nothing() {}
265 /// # Top-doc prose title
267 /// Text below heading.
269 /// ## Top-doc prose sub-heading
271 /// Text below heading.
272 pub union HeavilyDocumentedUnion {
273 /// # Title for union variant
274 /// ## Sub-heading for union variant
279 /// # Title for union impl doc
280 /// ## Sub-heading for union impl doc
281 impl HeavilyDocumentedUnion {
282 /// # Title for union impl-item doc
283 /// ## Sub-heading for union impl-item doc
284 pub fn do_nothing() {}
287 /// # Top-doc prose title
289 /// Text below heading.
291 /// ## Top-doc prose sub-heading
293 /// Text below heading.
295 macro_rules! heavily_documented_macro {
299 pub trait EmptyTrait1 {}
300 pub trait EmptyTrait2 {}
301 pub trait EmptyTrait3 {}
303 pub struct HasEmptyTraits{}
305 impl EmptyTrait1 for HasEmptyTraits {}
306 impl EmptyTrait2 for HasEmptyTraits {}
307 #[doc(cfg(feature = "some-feature"))]
308 impl EmptyTrait3 for HasEmptyTraits {}
313 #[doc(alias = "AliasForTheStdReexport")]
314 pub use ::std as TheStdReexport;
317 /// We check the appearance of the `<details>`/`<summary>` in here.
322 /// <summary><h4>I'm a summary</h4></summary>
323 /// <div>I'm the content of the details!</div>
328 /// We check the appearance of the `<details>`/`<summary>` in here.
333 /// <summary><h4>I'm a summary</h4></summary>
334 /// <div>I'm the content of the details!</div>
340 pub mod doc_block_table {
342 pub trait DocBlockTableTrait {
348 /// | header1 | header2 |
349 /// |--------------------------|--------------------------|
350 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
351 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
352 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
353 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
354 pub struct DocBlockTable {}
356 impl DocBlockTableTrait for DocBlockTable {
357 /// Trait impl func doc for struct.
359 /// | header1 | header2 |
360 /// |--------------------------|--------------------------|
361 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
369 pub struct NotableStructWithLongName<R>(R);
371 impl<R: std::io::Read> NotableStructWithLongName<R> {
372 pub fn create_an_iterator_from_read(r: R) -> NotableStructWithLongName<R> { Self(r) }
375 impl<R: std::io::Read> std::iter::Iterator for NotableStructWithLongName<R> {
378 fn next(&mut self) -> Option<Self::Item> { () }
381 pub trait TraitWithNoDocblocks {
386 pub struct TypeWithNoDocblocks;
388 impl TypeWithNoDocblocks {
389 fn x() -> Option<Self> {
392 fn y() -> Option<u32> {
399 impl TypeWithNoDocblocks {
400 pub fn first_fn(&self) {}
401 pub fn second_fn<'a>(&'a self) {
408 pub unsafe fn unsafe_fn() {}
413 pub struct WithGenerics<T: TraitWithNoDocblocks, S = String, E = WhoLetTheDogOut, P = i8> {
420 pub struct StructWithPublicUndocumentedFields {
425 pub const CONST: u8 = 0;
427 pub trait TraitWithoutGenerics {
434 pub mod trait_members {
435 pub trait TraitMembers {
440 /// Some other function
444 impl TraitMembers for HasTrait {
451 pub struct TypeWithImplDoc;
454 impl TypeWithImplDoc {
459 /// <sub id="codeblock-sub-1">
467 /// <sub id="codeblock-sub-3">
476 pub mod codeblock_sub {}
477 pub mod search_results {
479 pub struct SearchResults {