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")]
79 pub enum WhoLetTheDogOut
{
86 /// Who doesn't love to wrap a `format!` call?
87 pub fn some_more_function
<T
: fmt
::Debug
>(t
: &T
) -> String
{
92 pub trait AnotherOne
{
112 /// Check for "i" signs in lists!
120 /// 4. ```ignore (it's a test)
127 /// ```ignore (still a test)
130 pub fn check_list_code_block() {}
132 /// a thing with a label
133 #[deprecated(since = "1.0.0", note = "text why this deprecated")]
135 pub fn replaced_function() {}
137 /// Some doc with `code`!
139 WithVariants { and: usize, sub: usize, variants: usize }
,
142 #[doc(keyword = "CookieMonster")]
146 /// Just some type alias.
147 pub type SomeType
= u32;
149 pub mod huge_amount_of_consts
{
150 include
!(concat
!(env
!("OUT_DIR"), "/huge_amount_of_consts.rs"));
153 /// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
154 pub mod long_code_block {}
161 pub use crate::repro
as repro2
;
163 /// # Top-doc Prose title
165 /// Text below title.
167 /// ## Top-doc Prose sub-heading
169 /// Text below sub-heading.
171 /// ### Top-doc Prose sub-sub-heading
173 /// Text below sub-sub-heading
175 /// #### You know the drill.
178 pub struct HeavilyDocumentedStruct
{
179 /// # Title for field
180 /// ## Sub-heading for field
184 /// # Title for struct impl doc
186 /// Text below heading.
188 /// ## Sub-heading for struct impl doc
190 /// Text below sub-heading.
192 /// ### Sub-sub-heading for struct impl doc
194 /// Text below sub-sub-heading.
196 impl HeavilyDocumentedStruct
{
197 /// # Title for struct impl-item doc
198 /// Text below title.
199 /// ## Sub-heading for struct impl-item doc
200 /// Text below sub-heading.
201 /// ### Sub-sub-heading for struct impl-item doc
202 /// Text below sub-sub-heading.
203 pub fn do_nothing() {}
206 /// # Top-doc Prose title
208 /// Text below title.
210 /// ## Top-doc Prose sub-heading
212 /// Text below sub-heading.
214 /// ### Top-doc Prose sub-sub-heading
216 /// Text below sub-sub-heading
217 pub enum HeavilyDocumentedEnum
{
218 /// # None prose title
219 /// ## None prose sub-heading
221 /// # Wrapped prose title
222 /// ## Wrapped prose sub-heading
224 /// # Wrapped.0 prose title
225 /// ## Wrapped.0 prose sub-heading
230 /// # Structy prose title
231 /// ## Structy prose sub-heading
237 /// # Title for enum impl doc
239 /// Text below heading.
241 /// ## Sub-heading for enum impl doc
243 /// Text below sub-heading.
245 /// ### Sub-sub-heading for enum impl doc
247 /// Text below sub-sub-heading.
249 impl HeavilyDocumentedEnum
{
250 /// # Title for enum impl-item doc
251 /// Text below title.
252 /// ## Sub-heading for enum impl-item doc
253 /// Text below sub-heading.
254 /// ### Sub-sub-heading for enum impl-item doc
255 /// Text below sub-sub-heading.
256 pub fn do_nothing() {}
259 /// # Top-doc prose title
261 /// Text below heading.
263 /// ## Top-doc prose sub-heading
265 /// Text below heading.
266 pub union HeavilyDocumentedUnion
{
267 /// # Title for union variant
268 /// ## Sub-heading for union variant
273 /// # Title for union impl doc
274 /// ## Sub-heading for union impl doc
275 impl HeavilyDocumentedUnion
{
276 /// # Title for union impl-item doc
277 /// ## Sub-heading for union impl-item doc
278 pub fn do_nothing() {}
281 /// # Top-doc prose title
283 /// Text below heading.
285 /// ## Top-doc prose sub-heading
287 /// Text below heading.
289 macro_rules
! heavily_documented_macro
{
293 pub trait EmptyTrait1 {}
294 pub trait EmptyTrait2 {}
295 pub trait EmptyTrait3 {}
297 pub struct HasEmptyTraits{}
299 impl EmptyTrait1
for HasEmptyTraits {}
300 impl EmptyTrait2
for HasEmptyTraits {}
301 #[doc(cfg(feature = "some-feature"))]
302 impl EmptyTrait3
for HasEmptyTraits {}
307 #[doc(alias = "AliasForTheStdReexport")]
308 pub use ::std
as TheStdReexport
;
311 /// We check the appearance of the `<details>`/`<summary>` in here.
316 /// <summary><h4>I'm a summary</h4></summary>
317 /// <div>I'm the content of the details!</div>
322 /// We check the appearance of the `<details>`/`<summary>` in here.
327 /// <summary><h4>I'm a summary</h4></summary>
328 /// <div>I'm the content of the details!</div>
334 pub mod doc_block_table
{
336 pub trait DocBlockTableTrait
{
342 /// | header1 | header2 |
343 /// |--------------------------|--------------------------|
344 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
345 pub struct DocBlockTable {}
347 impl DocBlockTableTrait
for DocBlockTable
{
348 /// Trait impl func doc for struct.
350 /// | header1 | header2 |
351 /// |--------------------------|--------------------------|
352 /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
360 pub struct NotableStructWithLongName
<R
>(R
);
362 impl<R
: std
::io
::Read
> NotableStructWithLongName
<R
> {
363 pub fn create_an_iterator_from_read(r
: R
) -> NotableStructWithLongName
<R
> { Self(r) }
366 impl<R
: std
::io
::Read
> std
::iter
::Iterator
for NotableStructWithLongName
<R
> {
369 fn next(&mut self) -> Option
<Self::Item
> { () }
372 pub trait TraitWithNoDocblocks
{
377 pub struct TypeWithNoDocblocks
;
379 impl TypeWithNoDocblocks
{
380 fn x() -> Option
<Self> {
383 fn y() -> Option
<u32> {
390 impl TypeWithNoDocblocks
{
391 pub fn first_fn(&self) {}
392 pub fn second_fn
<'a
>(&'a
self) {
399 pub unsafe fn unsafe_fn() {}
404 pub struct WithGenerics
<T
: TraitWithNoDocblocks
, S
= String
, E
= WhoLetTheDogOut
, P
= i8> {
411 pub const CONST
: u8 = 0;
413 pub trait TraitWithoutGenerics
{