Closed
Description
let v = vec![1, 2, 3];
let boxed = Box::new(v.iter()) as Box<Iterator<Item=i32>>;
boxed.max() // IteratorExt::max(*boxed) also fails
This code will be failed to compile because boxed
holds a trait object that is unsized, and IteratorExt
requires the Sized
kind so IteratorExt
can only be implemented for sized types. Like IteratorExt::map()
, many methods in IteratorExt
consume self
, so requiring a sized type is necessary.
Adding impl Iterator for Box<Iterator>
(like Reader for Box<Reader>
) might solve this problem, but I'm worrying about the confliction with autoderef.