The standard naming convention for functions is:
to_* (&self, ...);
into_* (self, ...);
what, if any, is the naming convention for (&mut self, ...) ?
The standard naming convention for functions is:
to_* (&self, ...);
into_* (self, ...);
what, if any, is the naming convention for (&mut self, ...) ?
I see
Prefix Cost Ownership
as_ Free borrowed -> borrowed
to_ Expensive borrowed -> borrowed
borrowed -> owned (non-Copy types)
owned -> owned (Copy types)
into_ Variable owned -> owned (non-Copy types)
but it does not help me. Are you referring to a different section ?
You can use as_ or to_ for both &self and &mut self. The kind of borrow is not important — whether it is free is what determines the difference.