Re: [rust-dev] how to call closures stored in struct slots (a 0.5 question)
On Sat, Dec 22, 2012 at 10:27 AM, Steve Jenson ste...@fruitless.org wrote: In 0.4, I had a struct that stored a fn that I later called as if it were a method. In 0.5, this has ceased. what is the new syntax for calling functions stored in slots? Here's the small code example (please excuse how naive it is): https://github.com/stevej/rustled/blob/master/lazy.rs#L28 and here is the 0.5 compiler error I receive: lazy.rs:28:21: 28:33 error: type `lazy::Lazy'a` does not implement any method in scope named `code` lazy.rs:28 let result = self.code(); (Warning: not tested.) I believe the way to do this is to write: let result = (self.code)(); Cheers, Tim -- Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt We know there'd hardly be no one in prison / If rights to food, clothes, and shelter were given. -- Boots Riley ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev
Re: [rust-dev] how to call closures stored in struct slots (a 0.5 question)
Yes, that's it! Are these migration-related questions suited for this list or should I use github issues? thanks again, steve On Sat, Dec 22, 2012 at 10:28 AM, Tim Chevalier catamorph...@gmail.comwrote: On Sat, Dec 22, 2012 at 10:27 AM, Steve Jenson ste...@fruitless.org wrote: In 0.4, I had a struct that stored a fn that I later called as if it were a method. In 0.5, this has ceased. what is the new syntax for calling functions stored in slots? Here's the small code example (please excuse how naive it is): https://github.com/stevej/rustled/blob/master/lazy.rs#L28 and here is the 0.5 compiler error I receive: lazy.rs:28:21: 28:33 error: type `lazy::Lazy'a` does not implement any method in scope named `code` lazy.rs:28 let result = self.code(); (Warning: not tested.) I believe the way to do this is to write: let result = (self.code)(); Cheers, Tim -- Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt We know there'd hardly be no one in prison / If rights to food, clothes, and shelter were given. -- Boots Riley ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev
Re: [rust-dev] how to call closures stored in struct slots (a 0.5 question)
On Sat, Dec 22, 2012 at 10:32 AM, Steve Jenson ste...@fruitless.org wrote: Yes, that's it! Are these migration-related questions suited for this list or should I use github issues? github issues should generally be for situations where you're pretty sure that rustc/libraries are wrong or need improvement. The list or IRC is great for asking questions where you don't think there's a compiler bug. So you're doing it right :-) Cheers, Tim -- Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt We know there'd hardly be no one in prison / If rights to food, clothes, and shelter were given. -- Boots Riley ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev