]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/manual_impl.rs
Auto merge of #55041 - evq:thumbv8m, r=alexcrichton
[rust.git] / src / test / rustdoc / manual_impl.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // @has manual_impl/trait.T.html
12 // @has  - '//*[@class="docblock"]' 'Docs associated with the trait definition.'
13 // @has  - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
14 // @has  - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
15 /// Docs associated with the trait definition.
16 pub trait T {
17     /// Docs associated with the trait a_method definition.
18     fn a_method(&self) -> usize;
19
20     /// Docs associated with the trait b_method definition.
21     fn b_method(&self) -> usize {
22         self.a_method()
23     }
24
25     /// Docs associated with the trait c_method definition.
26     ///
27     /// There is another line
28     fn c_method(&self) -> usize {
29         self.a_method()
30     }
31 }
32
33 // @has manual_impl/struct.S1.html '//*[@class="trait"]' 'T'
34 // @has  - '//*[@class="docblock"]' 'Docs associated with the S1 trait implementation.'
35 // @has  - '//*[@class="docblock"]' 'Docs associated with the S1 trait a_method implementation.'
36 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
37 // @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
38 // @has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
39 // @!has - '//*[@class="docblock"]' 'There is another line'
40 // @has - '//*[@class="docblock"]' 'Read more'
41 pub struct S1(usize);
42
43 /// Docs associated with the S1 trait implementation.
44 impl T for S1 {
45     /// Docs associated with the S1 trait a_method implementation.
46     fn a_method(&self) -> usize {
47         self.0
48     }
49 }
50
51 // @has manual_impl/struct.S2.html '//*[@class="trait"]' 'T'
52 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait implementation.'
53 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait a_method implementation.'
54 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait c_method implementation.'
55 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
56 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
57 // @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
58 pub struct S2(usize);
59
60 /// Docs associated with the S2 trait implementation.
61 impl T for S2 {
62     /// Docs associated with the S2 trait a_method implementation.
63     fn a_method(&self) -> usize {
64         self.0
65     }
66
67     /// Docs associated with the S2 trait c_method implementation.
68     fn c_method(&self) -> usize {
69         5
70     }
71 }
72
73 // @has manual_impl/struct.S3.html '//*[@class="trait"]' 'T'
74 // @has  - '//*[@class="docblock"]' 'Docs associated with the S3 trait implementation.'
75 // @has  - '//*[@class="docblock"]' 'Docs associated with the S3 trait b_method implementation.'
76 // @has - '//*[@class="docblock hidden"]' 'Docs associated with the trait a_method definition.'
77 pub struct S3(usize);
78
79 /// Docs associated with the S3 trait implementation.
80 impl T for S3 {
81     fn a_method(&self) -> usize {
82         self.0
83     }
84
85     /// Docs associated with the S3 trait b_method implementation.
86     fn b_method(&self) -> usize {
87         5
88     }
89 }