If you want that, you'll need to use a custom pointer type instead of ~. You
can use ~ internally, and implement Deref/DerefMut to do the desired capturing.
pub struct PtrT {
value: ~T // assuming 0.10 here, master would be BoxT
}
implT PtrT {
pub fn new(val: T) - PtrT {
Ptr {
The ~int type has since moved to Boxint, which will one day be a
library type with Deref implemented on it (currently it is implemented
by the compiler). Regardless, there's no need to implement the Deref
trait for the type today, the compiler already takes care of it.
For example, your code will
On Tue, May 13, 2014 at 2:19 PM, Alex Crichton a...@crichton.co wrote:
The ~int type has since moved to Boxint, which will one day be a
library type with Deref implemented on it (currently it is implemented
by the compiler).
Thanks for the note. I'm using a slightly older version that doesn't