piston icon indicating copy to clipboard operation
piston copied to clipboard

Transformed implementation for Context and Copy

Open PvdBerg1998 opened this issue 6 years ago • 0 comments

Currently the transformed impl for Context takes a mut self and updates it's own field, but since Context is Copy, this doesn't actually change the struct, but a copy of it.

c.scale(a, b); // Does nothing

let x = c.scale(a, b);
// x is updated

This is very counter intuitive (at least to me) since by default a new Context structure is created so it can be mutated, and it has a 'current transformation' field, so I thought it would mutate that field. This is actually what happens, but on a copy since Context is Copy.

PvdBerg1998 avatar Dec 24 '17 19:12 PvdBerg1998