summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc/deref-mut-methods.rs
blob: fdf8434224f839b0a00453f32ae77eb2b147b3bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#![crate_name = "foo"]

use std::ops;

pub struct Foo;

impl Foo {
    pub fn foo(&mut self) {}
}

// @has foo/struct.Bar.html
// @has - '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.foo"]' 'foo'
pub struct Bar {
    foo: Foo,
}

impl ops::Deref for Bar {
    type Target = Foo;

    fn deref(&self) -> &Foo {
        &self.foo
    }
}

impl ops::DerefMut for Bar {
    fn deref_mut(&mut self) -> &mut Foo {
        &mut self.foo
    }
}