Registry / utility / retain-mut

retain-mut

JSON →
library0.1.9rscratesunverified

Provides retain_mut method that has the same functionality as retain but gives mutable borrow to the predicate.

# Cargo.toml [dependencies] retain_mut = "0.1.9"
INSTALL
IMPORT
SIG · RETAIN-MUT
R
retain-mut
utilityrustv0.1.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RetainMut
✓ use retain_mut::RetainMut;

Retains elements in a collection with a mutable predicate.

use retain_mut::RetainMut; fn main() { let mut vec = vec![1, 2, 3, 4]; vec.retain_mut(|x| { *x += 1; *x % 2 == 0 }); println!("{:?}", vec); // [2, 4] }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.1.9latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
retain-mut — cargo add retain-mut · libregistry