SHARE
TWEET

Untitled

a guest Jun 12th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #![allow(dead_code)]
  2.  
  3. struct FirstState;
  4. struct SecondState;
  5.  
  6. struct Thing<T> {
  7.     state: T,
  8.     num: i32,
  9. }
  10.  
  11. // Methods in this impl apply to all instances of Thing
  12. impl<T> Thing<T> {
  13.     fn foo() {
  14.        
  15.     }
  16. }
  17.  
  18. // Methods here only exist on Thing<FirstState>
  19. impl Thing<FirstState> {
  20.     fn a() {
  21.        
  22.     }
  23. }
  24.  
  25. // Methods here only exist on Thing<SecondState>
  26. impl Thing<SecondState> {
  27.     fn b() {
  28.        
  29.     }
  30. }
  31.  
  32. fn main() {
  33.     println!("asdf");
  34. }
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