Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Jelly {
- fn git(&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 {
- b.git();
- }
- }
Add Comment
Please, Sign In to add comment