Crates.io | retain_range |
lib.rs | retain_range |
version | 0.1.1 |
source | src |
created_at | 2023-10-30 03:08:26.805742 |
updated_at | 2023-10-30 03:15:03.892512 |
description | Extension of Vec::retain to operate only on part of the vector defined by a range. |
homepage | |
repository | https://github.com/kwyntes/retain_range |
max_upload_size | |
id | 1018008 |
size | 7,045 |
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]);