Skip to content

Commit

Permalink
Add rustdoc test for Deref to primitive types
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 27, 2022
1 parent 5856e40 commit 23c3941
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/rustdoc/deref-to-primitive.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![crate_name = "foo"]

// @has 'foo/struct.Foo.html'
// @has - '//*[@id="deref-methods-i32"]' 'Methods from Deref<Target = i32>'
// @has - '//*[@id="deref-methods-i32-1"]//*[@id="associatedconstant.BITS"]/h4' \
// 'pub const BITS: u32 = 32u32'
pub struct Foo(i32);

impl std::ops::Deref for Foo {
type Target = i32;

fn deref(&self) -> &Self::Target {
&self.0
}
}

0 comments on commit 23c3941

Please sign in to comment.