mut Functions
A struct is a value type, and regular member methods cannot modify instance fields. If you need to modify fields in a method, you must declare a mutable method using mut func.
Inside a mut function, this has the ability to modify fields in place. mut methods can only be called on var bindings; calling them on let bindings will result in a compilation error.
The code on the right defines a movable Point. translate, scale, and reset are all mut methods that can modify the x and y fields. Note that in main, the variable p is declared with var to be able to call these methods.
mut can only decorate instance member functions, not static member functions. Regular methods cannot call mut methods internally.
Try changing var p to let p and observe the error message reported by the compiler.