rust/library/alloc
Matthias Krüger bf228a87ff
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
2025-01-14 07:56:23 +01:00
..
benches update cfgs 2024-11-27 15:14:54 +00:00
src Rollup merge of #135381 - cod10129:vec-splice-doc, r=tgross35 2025-01-14 07:56:23 +01:00
tests alloc: remove unsound IsZero for raw pointers 2025-01-10 18:48:48 +01:00
Cargo.toml Update compiler-builtins to 0.1.140 2024-12-27 22:26:08 +00:00