SHARE
TWEET

Untitled

a guest Aug 17th, 2019 85 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
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