Advertisement
Guest User

Untitled

a guest
Jun 12th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement