retain_range

Crates.ioretain_range
lib.rsretain_range
version0.1.1
sourcesrc
created_at2023-10-30 03:08:26.805742
updated_at2023-10-30 03:15:03.892512
descriptionExtension of Vec::retain to operate only on part of the vector defined by a range.
homepage
repositoryhttps://github.com/kwyntes/retain_range
max_upload_size
id1018008
size7,045
(kwyntes)

documentation

README

retain_range

Extension of Vec::retain to operate only on part of the vector defined by a range.

let mut vec = vec![1, 2, 3, 4, 5];
vec.retain_range(1..=3, |&x| x <= 2);
assert_eq!(vec, [1, 2, 5]);
Commit count: 7

cargo fmt