leftiness / hex_math

MIT License
4 stars 1 forks source link

Implement functions using Into instead of Borrow #92

Closed leftiness closed 7 years ago

leftiness commented 7 years ago

Maybe don't do this. If I impl Into<Point> for MyType, then MyType.into() consumes MyType and returns Point. Sometimes I have a MyType which I don't want to consume, but I want to get a Point. That's the reason for using Borrow<Point>. I can easily impl Borrow<Point> for MyType, but I can't impl<T> Into<Point> for T where T: Borrow<Point> because you can only blanket implement a trait that you wrote in your own crate.

leftiness commented 7 years ago

Yeah. Can't do.