Last active
May 30, 2019 07:31
-
-
Save kinnison/001c508c2b63e3e65cd719acdadfa2ed to your computer and use it in GitHub Desktop.
A mechanism to think about hash and borrow implementations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Related to a comment from @nrc regarding Hash<Ty> and Borrow<Ty> interactions... | |
// I wonder if a generic hash implementation of: | |
impl<Outer: Borrow<Inner>, Inner: Hash> Hash for Outer { | |
fn hash<H: Hasher>(self: &Outer, state: &mut H) { | |
self.borrow().hash(state); | |
} | |
} | |
// Might solve the issue? Or at least mean that there's a generic way to deal with it? | |
// Note, I have no idea if that would work or not. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment