See also
for the unfortunate lack of the obvious fill
helper that you are probably looking for.
In the meantime, for a solution that iterates only once if your values have destructors, there's:
v.iter_mut().map(|x| *x = value).count();
See also
for the unfortunate lack of the obvious fill
helper that you are probably looking for.
In the meantime, for a solution that iterates only once if your values have destructors, there's:
v.iter_mut().map(|x| *x = value).count();