These are chat archives for rust-lang/rust

23rd
Oct 2015
'The 'Iterator' trait only requires the 'next' method to be defined. '
In this case i should not implement all methods of Iterator trait ?
Peter Atashian
@retep998
Oct 23 2015 12:41
@Vdimir Iterator provides default implements of all the methods except for next
You can implement those methods yourself though, if you think you can provide a better implementation than the default
Vdimir
@Vdimir
Oct 23 2015 12:44
@retep998 Thanks
John C F
@critiqjo
Oct 23 2015 16:45
Box docs says "A pointer type for heap allocation."
Even though Rc docs does not say so, it does heap allocation too, right? Or is it up to the compiler (optimizations) to decide?
Peter Atashian
@retep998
Oct 23 2015 16:45
@critiqjo Rc always heap allocates
John C F
@critiqjo
Oct 23 2015 16:47
@retep998 Oh, cool! Thanks!
panicbit
@panicbit
Oct 23 2015 16:58
retep998: Intersting, I didn't know that either! This means I can simplify some instances of Rc<Box<_>> to just Rc<_> :)
John C F
@critiqjo
Oct 23 2015 17:00
@panicbit From what I know, Rc<Box<_>> was needed for creating "trait objects", prior to 1.1, I think... But now, everything works with just Rc<_>...
panicbit
@panicbit
Oct 23 2015 17:01
Ah ok
John C F
@critiqjo
Oct 23 2015 17:06
* to clarify, "trait objects" needed to be Boxed to make it Sized, because Rc<_>didn't used to take unsized objects, but it does now...