Skip to content

Instantly share code, notes, and snippets.

@aturon
Created March 26, 2015 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aturon/d4355fe915a7bdaeadeb to your computer and use it in GitHub Desktop.
Save aturon/d4355fe915a7bdaeadeb to your computer and use it in GitHub Desktop.
// As lifts over Deref
impl<D: ?Sized + Deref, U: ?Sized> AsRef<U> for D where D::Target: AsRef<U> {
fn as_ref(&self) -> &U {
self.deref().as_ref()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment