Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Jelly {
- fn foo(&self) {}
- }
- struct Jone;
- impl Jelly for Jone {
- // fn git(self) {}
- }
- struct Jtwo;
- impl Jelly for Jtwo {
- // fn git(self) {}
- }
- fn main() {
- let js: Vec<Box<dyn Jelly>> = vec![
- Box::new(Jone {}),
- Box::new(Jtwo {}),
- ];
- for b in js.into_iter() {
- b.foo();
- }
- }
Add Comment
Please, Sign In to add comment