]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/manual_impl.rs
Auto merge of #33199 - mitaa:tokenize-responsibly, r=nrc
[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
26 // @has manual_impl/struct.S1.html '//*[@class="trait"]' 'T'
27 // @has  - '//*[@class="docblock"]' 'Docs associated with the S1 trait implementation.'
28 // @has  - '//*[@class="docblock"]' 'Docs associated with the S1 trait a_method implementation.'
29 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
30 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
31 pub struct S1(usize);
32
33 /// Docs associated with the S1 trait implementation.
34 impl T for S1 {
35     /// Docs associated with the S1 trait a_method implementation.
36     fn a_method(&self) -> usize {
37         self.0
38     }
39 }
40
41 // @has manual_impl/struct.S2.html '//*[@class="trait"]' 'T'
42 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait implementation.'
43 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait a_method implementation.'
44 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait b_method implementation.'
45 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
46 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
47 pub struct S2(usize);
48
49 /// Docs associated with the S2 trait implementation.
50 impl T for S2 {
51     /// Docs associated with the S2 trait a_method implementation.
52     fn a_method(&self) -> usize {
53         self.0
54     }
55
56     /// Docs associated with the S2 trait b_method implementation.
57     fn b_method(&self) -> usize {
58         5
59     }
60 }
61
62 // @has manual_impl/struct.S3.html '//*[@class="trait"]' 'T'
63 // @has  - '//*[@class="docblock"]' 'Docs associated with the S3 trait implementation.'
64 // @has  - '//*[@class="docblock"]' 'Docs associated with the S3 trait b_method implementation.'
65 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
66 pub struct S3(usize);
67
68 /// Docs associated with the S3 trait implementation.
69 impl T for S3 {
70     fn a_method(&self) -> usize {
71         self.0
72     }
73
74     /// Docs associated with the S3 trait b_method implementation.
75     fn b_method(&self) -> usize {
76         5
77     }
78 }