Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Drawable {
- fn draw(&self);
- fn add_to_holder(self, h: &mut Holder) where Self: Sized + 'static {
- h.items.push(Box::new(self))
- }
- }
- struct Holder {
- items:Vec<Box<dyn Drawable>>
- }
- fn main() {
- println!("Hello, world!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement