On Tue, Oct 29, 2013 at 10:14:13PM +1100, Brendan Zabarauskas wrote:
> > struct ntimes<T>(times: uint, value: T) -> T;
> 
> 
> Does this syntax work at the moment?

My mistake, I meant to leave off the `-> T`. It would just be:

    struct ntimes<T>(times: uint, value: T) -> T;
    impl<T:Clone> ntimes<T> {
        fn call(&mut self) -> Option<T> {
            if self.times == 0 {
               None
            } else {
               self.times -= 1;
               Some(self.value.clone());
            }
        }
    }



Niko
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to