]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/manual_impl.rs
befd3161ac48683c2681477cb961d3371c52aed8
[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 b_method definition.'
39 // @has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
40 // @!has - '//*[@class="docblock"]' 'There is another line'
41 // @has - '//*[@class="docblock"]' 'Read more'
42 pub struct S1(usize);
43
44 /// Docs associated with the S1 trait implementation.
45 impl T for S1 {
46     /// Docs associated with the S1 trait a_method implementation.
47     fn a_method(&self) -> usize {
48         self.0
49     }
50 }
51
52 // @has manual_impl/struct.S2.html '//*[@class="trait"]' 'T'
53 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait implementation.'
54 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait a_method implementation.'
55 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait c_method implementation.'
56 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
57 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
58 // @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
59 // @!has - '//*[@class="docblock"]' 'Read more'
60 pub struct S2(usize);
61
62 /// Docs associated with the S2 trait implementation.
63 impl T for S2 {
64     /// Docs associated with the S2 trait a_method implementation.
65     fn a_method(&self) -> usize {
66         self.0
67     }
68
69     /// Docs associated with the S2 trait c_method implementation.
70     fn c_method(&self) -> usize {
71         5
72     }
73 }
74
75 // @has manual_impl/struct.S3.html '//*[@class="trait"]' 'T'
76 // @has  - '//*[@class="docblock"]' 'Docs associated with the S3 trait implementation.'
77 // @has  - '//*[@class="docblock"]' 'Docs associated with the S3 trait b_method implementation.'
78 // @has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
79 pub struct S3(usize);
80
81 /// Docs associated with the S3 trait implementation.
82 impl T for S3 {
83     fn a_method(&self) -> usize {
84         self.0
85     }
86
87     /// Docs associated with the S3 trait b_method implementation.
88     fn b_method(&self) -> usize {
89         5
90     }
91 }