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)]
9 use std::convert::AsRef;
12 /// Basic function with some code examples:
15 /// println!("nothing fancy");
16 /// println!("but with two lines!");
19 /// A failing to compile one:
22 /// println!("where did my argument {} go? :'(");
27 /// ```ignore (it's a test)
28 /// Let's say I'm just some text will ya?
31 /// An inlined `code`!
34 /// Just a normal struct.
39 pub fn must_use(&self) -> bool {
44 impl AsRef<str> for Foo {
45 fn as_ref(&self) -> &str {
50 /// Just a normal enum.
53 #[doc(alias = "ThisIsAnAlias")]
54 pub enum WhoLetTheDogOut {
61 /// Who doesn't love to wrap a `format!` call?
62 pub fn some_more_function<T: fmt::Debug>(t: &T) -> String {
67 pub trait AnotherOne {
87 /// Check for "i" signs in lists!
95 /// 4. ```ignore (it's a test)
102 /// ```ignore (still a test)
105 pub fn check_list_code_block() {}
107 /// a thing with a label
108 #[deprecated(since = "1.0.0", note = "text why this deprecated")]
110 pub fn replaced_function() {}
112 /// Some doc with `code`!
114 WithVariants { and: usize, sub: usize, variants: usize },
117 #[doc(keyword = "CookieMonster")]
121 /// Just some type alias.
122 pub type SomeType = u32;
124 pub mod huge_amount_of_consts {
125 include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
128 /// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
129 pub mod long_code_block {}
136 pub use crate::repro as repro2;
138 /// # Top-doc Prose title
140 /// Text below title.
142 /// ## Top-doc Prose sub-heading
144 /// Text below sub-heading.
146 /// ### Top-doc Prose sub-sub-heading
148 /// Text below sub-sub-heading
149 pub struct HeavilyDocumentedStruct {
150 /// # Title for field
151 /// ## Sub-heading for field
155 /// # Title for struct impl doc
157 /// Text below heading.
159 /// ## Sub-heading for struct impl doc
161 /// Text below sub-heading.
163 /// ### Sub-sub-heading for struct impl doc
165 /// Text below sub-sub-heading.
167 impl HeavilyDocumentedStruct {
168 /// # Title for struct impl-item doc
169 /// Text below title.
170 /// ## Sub-heading for struct impl-item doc
171 /// Text below sub-heading.
172 /// ### Sub-sub-heading for struct impl-item doc
173 /// Text below sub-sub-heading.
174 pub fn do_nothing() {}
177 /// # Top-doc Prose title
179 /// Text below title.
181 /// ## Top-doc Prose sub-heading
183 /// Text below sub-heading.
185 /// ### Top-doc Prose sub-sub-heading
187 /// Text below sub-sub-heading
188 pub enum HeavilyDocumentedEnum {
189 /// # None prose title
190 /// ## None prose sub-heading
192 /// # Wrapped prose title
193 /// ## Wrapped prose sub-heading
195 /// # Wrapped.0 prose title
196 /// ## Wrapped.0 prose sub-heading
201 /// # Structy prose title
202 /// ## Structy prose sub-heading
208 /// # Title for enum impl doc
210 /// Text below heading.
212 /// ## Sub-heading for enum impl doc
214 /// Text below sub-heading.
216 /// ### Sub-sub-heading for enum impl doc
218 /// Text below sub-sub-heading.
220 impl HeavilyDocumentedEnum {
221 /// # Title for enum impl-item doc
222 /// Text below title.
223 /// ## Sub-heading for enum impl-item doc
224 /// Text below sub-heading.
225 /// ### Sub-sub-heading for enum impl-item doc
226 /// Text below sub-sub-heading.
227 pub fn do_nothing() {}
230 /// # Top-doc prose title
232 /// Text below heading.
234 /// ## Top-doc prose sub-heading
236 /// Text below heading.
237 pub union HeavilyDocumentedUnion {
238 /// # Title for union variant
239 /// ## Sub-heading for union variant
244 /// # Title for union impl doc
245 /// ## Sub-heading for union impl doc
246 impl HeavilyDocumentedUnion {
247 /// # Title for union impl-item doc
248 /// ## Sub-heading for union impl-item doc
249 pub fn do_nothing() {}
252 /// # Top-doc prose title
254 /// Text below heading.
256 /// ## Top-doc prose sub-heading
258 /// Text below heading.
260 macro_rules! heavily_documented_macro {