Guest User

Untitled

a guest
Aug 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. trait Jelly {
  2. fn git(&self);
  3. }
  4.  
  5. struct Jone;
  6. impl Jelly for Jone {
  7. fn git(&self) {}
  8. }
  9. struct Jtwo;
  10. impl Jelly for Jtwo {
  11. fn git(&self) {}
  12. }
  13.  
  14. fn main() {
  15. let js: Vec<Box<dyn Jelly>> = vec![
  16. Box::new(Jone {}),
  17. Box::new(Jtwo {}),
  18. ];
  19.  
  20. for b in &js {
  21. b.git();
  22. }
  23. }
Add Comment
Please, Sign In to add comment