resize
requires a default value:
fn resize(&mut self, new_len: usize, value: T)
While truncate
does not:
fn truncate(&mut self, len: usize)
If len is greater than the vector's current length,
truncate
has no effect.
Document: https://static.rust-lang.org/doc/master/std/vec/struct.Vec.html