[rust-dev] how to call closures stored in struct slots (a 0.5 question)

Steve Jenson stevej at fruitless.org
Sat Dec 22 10:27:04 PST 2012

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):


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();

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20121222/eaea082d/attachment.html>

More information about the Rust-dev mailing list