Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-07 Thread Tommi Tissari
> On 07 Apr 2014, at 08:44, Nicholas Radford wrote: > > I think the original question was, why does the zero trait require the add > trait. > If that was the original question, then my answer would be that std::num::Zero requires the Add trait because of the way it is specified: "Defines an ad

Re: [rust-dev] Some help needed in Vector of enum conversion

2014-04-07 Thread Rodrigo Rivas
On Sun, Apr 6, 2014 at 7:50 PM, Philippe Delrieu wrote: > I need some more help. > > The impl Iterator<&mut ~Base> for Container declaration generate the error: > error: missing lifetime specifier > So I had it but I can't manage to return the next value with the specified > life time. > The code

Re: [rust-dev] Some help needed in Vector of enum conversion

2014-04-07 Thread Philippe Delrieu
Thanks for your help. I'll test ASAP. I use the counter mutable var to have a simple implantation of the iterator to make the code works. Thank for you're example to show a better way. I was thinking of a similar way but I would like to avoid the specific struct with perhaps use a recursive cal

Re: [rust-dev] Some help needed in Vector of enum conversion

2014-04-07 Thread Philippe Delrieu
I try to implement the iterator like that: struct BaseItems<'a> { iter : Items<'a, ~BaseImpl> } impl<'a> Iterator<&'a ~Base> for BaseItems<'a> { fn next(&mut self) -> Option<&'a ~Base>{ match self.iter.next() { Some(ref baseimpl) => { Some