Guest User

Untitled

a guest
Aug 17th, 2019
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #[derive(Debug)]
  2. pub struct Jo { ip: String }
  3.  
  4. #[derive(Debug)]
  5. pub enum Data {
  6. Join(Jo),
  7. Pos(u8),
  8. }
  9.  
  10. trait Protocols
  11. {
  12. fn join(self);
  13. }
  14.  
  15. impl Protocols for Data
  16. {
  17. fn join(self) {
  18. println!("{:?}", self.ip); //<------------- ?
  19. }
  20. }
  21.  
  22. fn main() {
  23. let data = Data::Join(Jo{ip:"me".to_string()});
  24. data.join();
  25. }
RAW Paste Data