The guidelines below were approved by RFC #199.
Functions often come in multiple variants: immutably borrowed, mutably borrowed, and owned.
The right default depends on the function in question. Variants should be marked through suffixes.
If foo`foo` uses/produces an immutable borrow by default, use:
_mut`_mutsuffix (e.g.foo_mut`) for the mutably borrowed variant._move`_movesuffix (e.g.foo_move`) for the owned variant.If foo`foo` uses/produces owned data by default, use:
_ref`_refsuffix (e.g.foo_ref`) for the immutably borrowed variant._mut`_mutsuffix (e.g.foo_mut`) for the mutably borrowed variant.In the case of iterators, the moving variant can also be understood as
an into`intoconversion,into_iter, and`, and for x in v.into_iter() reads
arguably better than for x in v.iter_move(), so the convention is
into_iter.
For mutably borrowed variants, if the mut`mutqualifier is part of a type name (e.g.as_mut_slice`), it should appear as it would appear
in the type.