Skip to content

Commit

Permalink
Add test for DerefMut methods
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 5, 2019
1 parent d89bf91 commit 4fb29f9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/test/rustdoc/deref-mut-methods.rs
@@ -0,0 +1,29 @@
#![crate_name = "foo"]

use std::ops;

pub struct Foo;

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

// @has foo/struct.Bar.html
// @has - '//div[@class="sidebar-links"]/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
}
}

0 comments on commit 4fb29f9

Please sign in to comment.