]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/src/lib.rs
Rollup merge of #86101 - glittershark:bound-as-mut-doc-fix, r=m-ou-se
[rust.git] / src / test / rustdoc-gui / src / lib.rs
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"]
5 #![feature(doc_keyword)]
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]
33     pub fn must_use(&self) -> bool {
34         true
35     }
36 }
37
38 /// Just a normal enum.
39 #[doc(alias = "ThisIsAnAlias")]
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 {
54     /// Some func 3.
55     fn func3();
56
57     /// Some func 1.
58     fn func1();
59
60     fn another();
61     fn why_not();
62
63     /// Some func 2.
64     fn func2();
65
66     fn hello();
67 }
68
69 /// ```compile_fail
70 /// whatever
71 /// ```
72 ///
73 /// Check for "i" signs in lists!
74 ///
75 /// 1. elem 1
76 /// 2. test 1
77 ///    ```compile_fail
78 ///    fn foo() {}
79 ///    ```
80 /// 3. elem 3
81 /// 4. ```ignore (it's a test)
82 ///    fn foo() {}
83 ///    ```
84 /// 5. elem 5
85 ///
86 /// Final one:
87 ///
88 /// ```ignore (still a test)
89 /// let x = 12;
90 /// ```
91 pub fn check_list_code_block() {}
92
93 pub enum AnEnum {
94     WithVariants { and: usize, sub: usize, variants: usize },
95 }
96
97 #[doc(keyword = "CookieMonster")]
98 pub mod keyword {}
99
100 /// Just some type alias.
101 pub type SomeType = u32;