piston
piston copied to clipboard
Transformed implementation for Context and Copy
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.