about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-14 07:56:23 +0100
committerGitHub <noreply@github.com>2025-01-14 07:56:23 +0100
commitbf228a87ff5f836a034e9fa7d2da2308af740d17 (patch)
treed9ab0ad583a5627b357af20e138bca02f11b6816 /compiler/rustc_codegen_llvm/src
parent35c2908177a17ca4e0acbc9013e42ee525ba155c (diff)
parentb11f87a53cb3405eafc6af02ce41b4ef2756c174 (diff)
downloadrust-bf228a87ff5f836a034e9fa7d2da2308af740d17.tar.gz
rust-bf228a87ff5f836a034e9fa7d2da2308af740d17.zip
Rollup merge of #135381 - cod10129:vec-splice-doc, r=tgross35
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
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions