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.
4 #![crate_name = "test_docs"]
5 #![feature(rustdoc_internals)]
8 use std::convert::AsRef;
11 /// Basic function with some code examples:
14 /// println!("nothing fancy");
15 /// println!("but with two lines!");
18 /// A failing to compile one:
21 /// println!("where did my argument {} go? :'(");
26 /// ```ignore (it's a test)
27 /// Let's say I'm just some text will ya?
30 /// An inlined `code`!
33 /// Just a normal struct.
38 pub fn must_use(&self) -> bool {
43 impl AsRef<str> for Foo {
44 fn as_ref(&self) -> &str {
49 /// Just a normal enum.
52 #[doc(alias = "ThisIsAnAlias")]
53 pub enum WhoLetTheDogOut {
60 /// Who doesn't love to wrap a `format!` call?
61 pub fn some_more_function<T: fmt::Debug>(t: &T) -> String {
66 pub trait AnotherOne {
86 /// Check for "i" signs in lists!
94 /// 4. ```ignore (it's a test)
101 /// ```ignore (still a test)
104 pub fn check_list_code_block() {}
106 /// a thing with a label
107 #[deprecated(since = "1.0.0", note = "text why this deprecated")]
109 pub fn replaced_function() {}
111 /// Some doc with `code`!
113 WithVariants { and: usize, sub: usize, variants: usize },
116 #[doc(keyword = "CookieMonster")]
120 /// Just some type alias.
121 pub type SomeType = u32;
123 pub mod huge_amount_of_consts {
124 include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
127 /// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
128 pub mod long_code_block {}
135 pub use crate::repro as repro2;
137 /// # Top-doc Prose title
139 /// Text below title.
141 /// ## Top-doc Prose sub-heading
143 /// Text below sub-heading.
145 /// ### Top-doc Prose sub-sub-heading
147 /// Text below sub-sub-heading
148 pub struct HeavilyDocumentedStruct {
149 /// # Title for field
150 /// ## Sub-heading for field
154 /// # Title for struct impl doc
156 /// Text below heading.
158 /// ## Sub-heading for struct impl doc
160 /// Text below sub-heading.
162 /// ### Sub-sub-heading for struct impl doc
164 /// Text below sub-sub-heading.
166 impl HeavilyDocumentedStruct {
167 /// # Title for struct impl-item doc
168 /// Text below title.
169 /// ## Sub-heading for struct impl-item doc
170 /// Text below sub-heading.
171 /// ### Sub-sub-heading for struct impl-item doc
172 /// Text below sub-sub-heading.
173 pub fn do_nothing() {}
176 /// # Top-doc Prose title
178 /// Text below title.
180 /// ## Top-doc Prose sub-heading
182 /// Text below sub-heading.
184 /// ### Top-doc Prose sub-sub-heading
186 /// Text below sub-sub-heading
187 pub enum HeavilyDocumentedEnum {
188 /// # None prose title
189 /// ## None prose sub-heading
191 /// # Wrapped prose title
192 /// ## Wrapped prose sub-heading
194 /// # Wrapped.0 prose title
195 /// ## Wrapped.0 prose sub-heading
200 /// # Structy prose title
201 /// ## Structy prose sub-heading
207 /// # Title for enum impl doc
209 /// Text below heading.
211 /// ## Sub-heading for enum impl doc
213 /// Text below sub-heading.
215 /// ### Sub-sub-heading for enum impl doc
217 /// Text below sub-sub-heading.
219 impl HeavilyDocumentedEnum {
220 /// # Title for enum impl-item doc
221 /// Text below title.
222 /// ## Sub-heading for enum impl-item doc
223 /// Text below sub-heading.
224 /// ### Sub-sub-heading for enum impl-item doc
225 /// Text below sub-sub-heading.
226 pub fn do_nothing() {}
229 /// # Top-doc prose title
231 /// Text below heading.
233 /// ## Top-doc prose sub-heading
235 /// Text below heading.
236 pub union HeavilyDocumentedUnion {
237 /// # Title for union variant
238 /// ## Sub-heading for union variant
243 /// # Title for union impl doc
244 /// ## Sub-heading for union impl doc
245 impl HeavilyDocumentedUnion {
246 /// # Title for union impl-item doc
247 /// ## Sub-heading for union impl-item doc
248 pub fn do_nothing() {}
251 /// # Top-doc prose title
253 /// Text below heading.
255 /// ## Top-doc prose sub-heading
257 /// Text below heading.
259 macro_rules! heavily_documented_macro {