daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. trait T<T> {
  2.     fn test(t: T) -> bool;
  3. }
  4.  
  5. struct Test;
  6.  
  7. impl T<i32> for Test {
  8.     fn test(t: i32) -> bool {
  9.         println!("i32 impl!");
  10.         t % 2 == 0
  11.     }
  12. }
  13.  
  14. impl T<bool> for Test {
  15.     fn test(t: bool) -> bool {
  16.         println!("bool impl!");
  17.         t
  18.     }
  19. }
  20.  
  21.  
  22. fn main() {
  23.     let t1 = Test::test(2);
  24.     let t2 = Test::test(false);
  25.     println!("{T1}, {T2}", T1 = t1, T2 = t2)
  26. }
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
 
Top