Re: [rust-dev] how to capture de-reference to ~int

2014-05-16 Thread Kevin Ballard
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 {

Re: [rust-dev] how to capture de-reference to ~int

2014-05-13 Thread Alex Crichton
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

Re: [rust-dev] how to capture de-reference to ~int

2014-05-13 Thread Noah Watkins
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