On Sat, Jul 6, 2013 at 10:09 PM, Ashish Myles <[email protected]> wrote: > Perhaps this was an oversight as the code base has developed > organically. But in case it was intentional, I just wanted to check. > > libstd/to_str.rs defines each of the following impls > impl<'self,A:ToStr> ToStr for &'self [A] > impl<A:ToStr> ToStr for ~[A] > impl<A:ToStr> ToStr for @[A] > whereas only the first one seems to be needed to cover all array > cases. To test this, I defined an equivalent MyToStr trait, defining > only the implementation for &'self [A], and it seemed to work for all > the array types. So just to check: is there any particular reason one > would want to define all three with identical implementation?
Vectors will coerce to slices, but the traits still need to be defined on them for it to work in generic code where you only have a type via a generic type parameter. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
