1.

Explain the rule of using &self, self and &mut self in the declaration method?

Answer»

&SELF : when Read-only REFERENCE is REQUIRED to the FUNCTION.

self : When a value is to be consumed by the function.

&mut : When a value needs to be MUTATED by the function with consuming it.



Discussion

No Comment Found