-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Truncate deletes all entries after offset. This makes it impossible to remove the first element, because it is retained even when truncate(0). I believe it is for this reason that truncate on Vec also truncates the element passed.
fn main() {
let mut vec = vec![1,2,3];
vec.truncate(0);
println!("{:?}", vec);
}
>>> []
I'd be happy to open a PR on this if I knew what direction you wanted to take it. New method or update the old one?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels