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 {}
162 pub use crate::repro as repro2;
164 /// # Top-doc Prose title
166 /// Text below title.
168 /// ## Top-doc Prose sub-heading
170 /// Text below sub-heading.
172 /// ### Top-doc Prose sub-sub-heading
174 /// Text below sub-sub-heading
176 /// #### You know the drill.
179 pub struct HeavilyDocumentedStruct {
180 /// # Title for field
181 /// ## Sub-heading for field
185 /// # Title for struct impl doc
187 /// Text below heading.
189 /// ## Sub-heading for struct impl doc
191 /// Text below sub-heading.
193 /// ### Sub-sub-heading for struct impl doc
195 /// Text below sub-sub-heading.
197 impl HeavilyDocumentedStruct {
198 /// # Title for struct impl-item doc
199 /// Text below title.
200 /// ## Sub-heading for struct impl-item doc
201 /// Text below sub-heading.
202 /// ### Sub-sub-heading for struct impl-item doc
203 /// Text below sub-sub-heading.
204 pub fn do_nothing() {}
207 /// # Top-doc Prose title
209 /// Text below title.
211 /// ## Top-doc Prose sub-heading
213 /// Text below sub-heading.
215 /// ### Top-doc Prose sub-sub-heading
217 /// Text below sub-sub-heading
218 pub enum HeavilyDocumentedEnum {
219 /// # None prose title
220 /// ## None prose sub-heading
222 /// # Wrapped prose title
223 /// ## Wrapped prose sub-heading
225 /// # Wrapped.0 prose title
226 /// ## Wrapped.0 prose sub-heading
231 /// # Structy prose title
232 /// ## Structy prose sub-heading
238 /// # Title for enum impl doc
240 /// Text below heading.
242 /// ## Sub-heading for enum impl doc
244 /// Text below sub-heading.
246 /// ### Sub-sub-heading for enum impl doc
248 /// Text below sub-sub-heading.
250 impl HeavilyDocumentedEnum {
251 /// # Title for enum impl-item doc
252 /// Text below title.
253 /// ## Sub-heading for enum impl-item doc
254 /// Text below sub-heading.
255 /// ### Sub-sub-heading for enum impl-item doc
256 /// Text below sub-sub-heading.
257 pub fn do_nothing() {}
260 /// # Top-doc prose title
262 /// Text below heading.
264 /// ## Top-doc prose sub-heading
266 /// Text below heading.
267 pub union HeavilyDocumentedUnion {
268 /// # Title for union variant
269 /// ## Sub-heading for union variant
274 /// # Title for union impl doc
275 /// ## Sub-heading for union impl doc
276 impl HeavilyDocumentedUnion {
277 /// # Title for union impl-item doc
278 /// ## Sub-heading for union impl-item doc
279 pub fn do_nothing() {}
282 /// # Top-doc prose title
284 /// Text below heading.
286 /// ## Top-doc prose sub-heading
288 /// Text below heading.
290 macro_rules! heavily_documented_macro {
294 pub trait EmptyTrait1 {}
295 pub trait EmptyTrait2 {}
296 pub trait EmptyTrait3 {}
298 pub struct HasEmptyTraits{}
300 impl EmptyTrait1 for HasEmptyTraits {}
301 impl EmptyTrait2 for HasEmptyTraits {}
302 #[doc(cfg(feature = "some-feature"))]
303 impl EmptyTrait3 for HasEmptyTraits {}
308 #[doc(alias = "AliasForTheStdReexport")]
309 pub use ::std as TheStdReexport;
312 /// We check the appearance of the `<details>`/`<summary>` in here.
317 /// <summary><h4>I'm a summary</h4></summary>
318 /// <div>I'm the content of the details!</div>
323 /// We check the appearance of the `<details>`/`<summary>` in here.
328 /// <summary><h4>I'm a summary</h4></summary>
329 /// <div>I'm the content of the details!</div>
335 pub mod doc_block_table {
337 pub trait DocBlockTableTrait {
343 /// | header1 | header2 |
344 /// |--------------------------|--------------------------|
345 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
346 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
347 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
348 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
349 pub struct DocBlockTable {}
351 impl DocBlockTableTrait for DocBlockTable {
352 /// Trait impl func doc for struct.
354 /// | header1 | header2 |
355 /// |--------------------------|--------------------------|
356 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
364 pub struct NotableStructWithLongName<R>(R);
366 impl<R: std::io::Read> NotableStructWithLongName<R> {
367 pub fn create_an_iterator_from_read(r: R) -> NotableStructWithLongName<R> { Self(r) }
370 impl<R: std::io::Read> std::iter::Iterator for NotableStructWithLongName<R> {
373 fn next(&mut self) -> Option<Self::Item> { () }
376 pub trait TraitWithNoDocblocks {
381 pub struct TypeWithNoDocblocks;
383 impl TypeWithNoDocblocks {
384 fn x() -> Option<Self> {
387 fn y() -> Option<u32> {
394 impl TypeWithNoDocblocks {
395 pub fn first_fn(&self) {}
396 pub fn second_fn<'a>(&'a self) {
403 pub unsafe fn unsafe_fn() {}
408 pub struct WithGenerics<T: TraitWithNoDocblocks, S = String, E = WhoLetTheDogOut, P = i8> {
415 pub struct StructWithPublicUndocumentedFields {
420 pub const CONST: u8 = 0;
422 pub trait TraitWithoutGenerics {
429 pub mod trait_members {
430 pub trait TraitMembers {
435 /// Some other function
439 impl TraitMembers for HasTrait {