Re: [rust-dev] How to use dynamic polymorphism with collection

2014-02-09 Thread Philippe Delrieu
Thank you. My problem is more complex than the example I gave. Your answer help me in reorganizing my code. I use a lib that as generic method that why I put generic in the example. I remove them and change the way I pass parameters. I didn't solve everything but I think I'm progressing. If I

Re: [rust-dev] How to use dynamic polymorphism with collection

2014-02-08 Thread Ashish Myles
On Sat, Feb 8, 2014 at 6:48 PM, Ashish Myles wrote: > > On Sat, Feb 8, 2014 at 1:21 PM, Philippe Delrieu > wrote: > >> pub trait Base { >> fn do_base(&self); >> } >> >> struct TestBase; >> >> impl Base for TestBase{ >> fn do_base(&self){ >> println!("ici"); >> } >> }

Re: [rust-dev] How to use dynamic polymorphism with collection

2014-02-08 Thread Ashish Myles
On Sat, Feb 8, 2014 at 1:21 PM, Philippe Delrieu wrote: > pub trait Base { > fn do_base(&self); > } > > struct TestBase; > > impl Base for TestBase{ > fn do_base(&self){ > println!("ici"); > } > } > > trait GenerciFn{ > fn do_generic(&self, base: &T); > } > > st

[rust-dev] How to use dynamic polymorphism with collection

2014-02-08 Thread Philippe Delrieu
Hello, I can't find a solution to a polymorphic problem. I construct a system to compute a value but I want it to be generic so it doesn't have to know on what type it computes. So I use generic and it works fine. Now the system store the object on what it computes in a collection ([]). The obj