Skip to content

Commit 4fb29f9

Browse files
Add test for DerefMut methods
1 parent d89bf91 commit 4fb29f9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/test/rustdoc/deref-mut-methods.rs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#![crate_name = "foo"]
2+
3+
use std::ops;
4+
5+
pub struct Foo;
6+
7+
impl Foo {
8+
pub fn foo(&mut self) {}
9+
}
10+
11+
// @has foo/struct.Bar.html
12+
// @has - '//div[@class="sidebar-links"]/a[@href="#method.foo"]' 'foo'
13+
pub struct Bar {
14+
foo: Foo,
15+
}
16+
17+
impl ops::Deref for Bar {
18+
type Target = Foo;
19+
20+
fn deref(&self) -> &Foo {
21+
&self.foo
22+
}
23+
}
24+
25+
impl ops::DerefMut for Bar {
26+
fn deref_mut(&mut self) -> &mut Foo {
27+
&mut self.foo
28+
}
29+
}

0 commit comments

Comments
 (0)