]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/escape-deref-methods.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / tests / rustdoc / escape-deref-methods.rs
1 #![crate_name = "foo"]
2
3 use std::ops::{Deref, DerefMut};
4
5 #[derive(Debug, Clone)]
6 pub struct Title {
7     name: String,
8 }
9
10 #[derive(Debug, Clone)]
11 pub struct TitleList {
12     pub members: Vec<Title>,
13 }
14
15 impl TitleList {
16     pub fn new() -> Self {
17         TitleList { members: Vec::new() }
18     }
19 }
20
21 impl Deref for TitleList {
22     type Target = Vec<Title>;
23
24     fn deref(&self) -> &Self::Target {
25         &self.members
26     }
27 }
28
29 // @has foo/struct.TitleList.html
30 // @has - '//div[@class="sidebar-elems"]//h3' 'Methods from Deref<Target=Vec<Title>>'
31 impl DerefMut for TitleList {
32     fn deref_mut(&mut self) -> &mut Self::Target {
33         &mut self.members
34     }
35 }