Skip to content

Commit

Permalink
Merge pull request #134 from sunshowers/asref
Browse files Browse the repository at this point in the history
add AsRef<Index> impl for Index
  • Loading branch information
rex-remind101 authored Jul 31, 2023
2 parents 8586d8d + 90fb08c commit 4a28bef
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions proptest/src/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ impl Index {
}
}

// This impl is handy for generic code over any type that exposes an internal `Index` -- with it,
// a plain `Index` can be passed in as well.
impl AsRef<Index> for Index {
fn as_ref(&self) -> &Index {
self
}
}

mapfn! {
[] fn UsizeToIndex[](raw: usize) -> Index {
Index(raw)
Expand Down

0 comments on commit 4a28bef

Please sign in to comment.