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(doc_keyword)]
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.
50 #[doc(alias = "ThisIsAnAlias")]
51 pub enum WhoLetTheDogOut {
58 /// Who doesn't love to wrap a `format!` call?
59 pub fn some_more_function<T: fmt::Debug>(t: &T) -> String {
64 pub trait AnotherOne {
84 /// Check for "i" signs in lists!
92 /// 4. ```ignore (it's a test)
99 /// ```ignore (still a test)
102 pub fn check_list_code_block() {}
104 /// a thing with a label
105 #[deprecated(since = "1.0.0", note = "text why this deprecated")]
107 pub fn replaced_function() {}
109 /// Some doc with `code`!
111 WithVariants { and: usize, sub: usize, variants: usize },
114 #[doc(keyword = "CookieMonster")]
118 /// Just some type alias.
119 pub type SomeType = u32;
121 pub mod huge_amount_of_consts {
122 include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs"));
125 /// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
126 pub mod long_code_block {}
133 pub use crate::repro as repro2;
135 /// # Top-doc Prose title
137 /// Text below title.
139 /// ## Top-doc Prose sub-heading
141 /// Text below sub-heading.
143 /// ### Top-doc Prose sub-sub-heading
145 /// Text below sub-sub-heading
146 pub struct HeavilyDocumentedStruct {
147 /// # Title for field
148 /// ## Sub-heading for field
152 /// # Title for struct impl doc
154 /// Text below heading.
156 /// ## Sub-heading for struct impl doc
158 /// Text below sub-heading.
160 /// ### Sub-sub-heading for struct impl doc
162 /// Text below sub-sub-heading.
164 impl HeavilyDocumentedStruct {
165 /// # Title for struct impl-item doc
166 /// Text below title.
167 /// ## Sub-heading for struct impl-item doc
168 /// Text below sub-heading.
169 /// ### Sub-sub-heading for struct impl-item doc
170 /// Text below sub-sub-heading.
171 pub fn do_nothing() {}
174 /// # Top-doc Prose title
176 /// Text below title.
178 /// ## Top-doc Prose sub-heading
180 /// Text below sub-heading.
182 /// ### Top-doc Prose sub-sub-heading
184 /// Text below sub-sub-heading
185 pub enum HeavilyDocumentedEnum {
186 /// # None prose title
187 /// ## None prose sub-heading
189 /// # Wrapped prose title
190 /// ## Wrapped prose sub-heading
192 /// # Wrapped.0 prose title
193 /// ## Wrapped.0 prose sub-heading
198 /// # Structy prose title
199 /// ## Structy prose sub-heading
205 /// # Title for enum impl doc
207 /// Text below heading.
209 /// ## Sub-heading for enum impl doc
211 /// Text below sub-heading.
213 /// ### Sub-sub-heading for enum impl doc
215 /// Text below sub-sub-heading.
217 impl HeavilyDocumentedEnum {
218 /// # Title for enum impl-item doc
219 /// Text below title.
220 /// ## Sub-heading for enum impl-item doc
221 /// Text below sub-heading.
222 /// ### Sub-sub-heading for enum impl-item doc
223 /// Text below sub-sub-heading.
224 pub fn do_nothing() {}
227 /// # Top-doc prose title
229 /// Text below heading.
231 /// ## Top-doc prose sub-heading
233 /// Text below heading.
234 pub union HeavilyDocumentedUnion {
235 /// # Title for union variant
236 /// ## Sub-heading for union variant
241 /// # Title for union impl doc
242 /// ## Sub-heading for union impl doc
243 impl HeavilyDocumentedUnion {
244 /// # Title for union impl-item doc
245 /// ## Sub-heading for union impl-item doc
246 pub fn do_nothing() {}
249 /// # Top-doc prose title
251 /// Text below heading.
253 /// ## Top-doc prose sub-heading
255 /// Text below heading.
257 macro_rules! heavily_documented_macro {