leftiness / hex_math

MIT License
4 stars 1 forks source link

Refactor to eliminate the need to clone when std::ops::Add, etc #8

Closed leftiness closed 8 years ago

leftiness commented 8 years ago

point + point requires type Point. Type &Point doesn't work, so I've been using point.clone() to get around that. There's apparently a better way.

http://stackoverflow.com/questions/36873837/choose-to-borrow-or-pass-ownership-without-duplicating-code-in-rust

... same for subtraction.

leftiness commented 8 years ago

Nah. Idk what that Borrow<> bit is, but the real solution is to just impl Add for &Point and then &Point + &Point.