0.1.0 Sep 6, 2019

#19 in #locations

MIT license

5KB
86 lines

mMut

MutPair

Get mutalbe references to two locations in Collection by key.

use mmut::MutPair;
let mut v = vec![1, 2, 3, 4, 5];

let (a, b) = v.two_mut(1, 3).unwrap();
*a = 8;
*b = 7;


assert_eq!(v, vec![1, 8, 3, 7, 5]);

lib.rs:

mMut

MutPair

Get mutalbe references to two locations in Collection by key.

use mmut::MutPair;

let mut v = vec![1, 2, 3, 4, 5];

let (a, b) = v.mut_pair(1, 3).unwrap();
*a = 8;
*b = 7;

assert_eq!(v, vec![1, 8, 3, 7, 5]);

No runtime deps