]>
Commit | Line | Data |
---|---|---|
6a06907d XL |
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 | ||
4 | #![crate_name = "test_docs"] | |
17df50a5 | 5 | #![feature(doc_keyword)] |
6a06907d XL |
6 | |
7 | use std::fmt; | |
8 | ||
9 | /// Basic function with some code examples: | |
10 | /// | |
11 | /// ``` | |
12 | /// println!("nothing fancy"); | |
13 | /// ``` | |
14 | /// | |
15 | /// A failing to compile one: | |
16 | /// | |
17 | /// ```compile_fail | |
18 | /// println!("where did my argument {} go? :'("); | |
19 | /// ``` | |
20 | /// | |
21 | /// An ignored one: | |
22 | /// | |
23 | /// ```ignore (it's a test) | |
24 | /// Let's say I'm just some text will ya? | |
25 | /// ``` | |
26 | pub fn foo() {} | |
27 | ||
28 | /// Just a normal struct. | |
29 | pub struct Foo; | |
30 | ||
31 | impl Foo { | |
32 | #[must_use] | |
cdc7bbd5 XL |
33 | pub fn must_use(&self) -> bool { |
34 | true | |
35 | } | |
6a06907d XL |
36 | } |
37 | ||
38 | /// Just a normal enum. | |
17df50a5 | 39 | #[doc(alias = "ThisIsAnAlias")] |
6a06907d XL |
40 | pub enum WhoLetTheDogOut { |
41 | /// Woof! | |
42 | Woof, | |
43 | /// Meoooooooow... | |
44 | Meow, | |
45 | } | |
46 | ||
47 | /// Who doesn't love to wrap a `format!` call? | |
48 | pub fn some_more_function<T: fmt::Debug>(t: &T) -> String { | |
49 | format!("{:?}", t) | |
50 | } | |
51 | ||
52 | /// Woohoo! A trait! | |
53 | pub trait AnotherOne { | |
cdc7bbd5 XL |
54 | /// Some func 3. |
55 | fn func3(); | |
56 | ||
6a06907d XL |
57 | /// Some func 1. |
58 | fn func1(); | |
59 | ||
cdc7bbd5 XL |
60 | fn another(); |
61 | fn why_not(); | |
62 | ||
6a06907d XL |
63 | /// Some func 2. |
64 | fn func2(); | |
65 | ||
cdc7bbd5 | 66 | fn hello(); |
6a06907d XL |
67 | } |
68 | ||
cdc7bbd5 XL |
69 | /// ```compile_fail |
70 | /// whatever | |
71 | /// ``` | |
72 | /// | |
6a06907d XL |
73 | /// Check for "i" signs in lists! |
74 | /// | |
75 | /// 1. elem 1 | |
cdc7bbd5 XL |
76 | /// 2. test 1 |
77 | /// ```compile_fail | |
78 | /// fn foo() {} | |
79 | /// ``` | |
6a06907d XL |
80 | /// 3. elem 3 |
81 | /// 4. ```ignore (it's a test) | |
82 | /// fn foo() {} | |
83 | /// ``` | |
84 | /// 5. elem 5 | |
cdc7bbd5 XL |
85 | /// |
86 | /// Final one: | |
87 | /// | |
88 | /// ```ignore (still a test) | |
89 | /// let x = 12; | |
90 | /// ``` | |
6a06907d | 91 | pub fn check_list_code_block() {} |
cdc7bbd5 XL |
92 | |
93 | pub enum AnEnum { | |
94 | WithVariants { and: usize, sub: usize, variants: usize }, | |
95 | } | |
17df50a5 XL |
96 | |
97 | #[doc(keyword = "CookieMonster")] | |
98 | pub mod keyword {} | |
99 | ||
100 | /// Just some type alias. | |
101 | pub type SomeType = u32; |