SHARE
TWEET

Untitled

a guest Jul 21st, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::ops::Deref;
  2. pub struct UserId(i64);
  3.  
  4. impl From<i64> for UserId {
  5.     fn from(id: i64) -> Self {
  6.         UserId(id)
  7.     }
  8. }
  9.  
  10. impl<S> From<S> for UserId
  11.     where
  12.         S: Deref,
  13.         S::Target: Into<UserId>,
  14. {
  15.     fn from(s: S) -> Self {
  16.         s.deref().into()
  17.     }
  18. }
  19.  
  20. fn main() {}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top