mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-03 18:57:19 +00:00

Add an example for `Vec::splice` inserting elements without removing This example clearly showcases how `splice` can be used to insert multiple elements efficiently at an index into a vector. Fixes #135369. The added example: > Using `splice` to insert new items into a vector efficiently at a specific position indicated by an empty range: > ```rust > let mut v = vec![1, 5]; > let new = [2, 3, 4]; > v.splice(1..1, new); > assert_eq!(v, [1, 2, 3, 4, 5]); > ``` `@rustbot` label A-docs A-collections