SHARE
TWEET

Untitled

a guest May 27th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pub struct Bot {
  2.     name : String,
  3.     lifetime : u32,
  4. }
  5.  
  6. pub trait BotInfo {
  7.     fn bot_info (&self) -> String
  8.     {
  9.         String::from("name : {}\nlifetime : {}\n", self.name, self.lifetime)
  10.     }
  11. }
  12.  
  13. impl BotInfo for Bot {}
  14.  
  15. fn main ()
  16. {
  17.  
  18.     let bot : Bot = Bot {
  19.         name : String::from("bot"),
  20.         lifetime : 12,
  21.     };
  22.    
  23.     bot.bot_info();
  24. }
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