Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. trait Drawable {
  2. fn draw(&self);
  3. fn add_to_holder(self, h: &mut Holder) where Self: Sized + 'static {
  4. h.items.push(Box::new(self))
  5. }
  6. }
  7.  
  8. struct Holder {
  9. items:Vec<Box<dyn Drawable>>
  10. }
  11.  
  12.  
  13. fn main() {
  14. println!("Hello, world!");
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement