[][src]Trait mmut::MutPair

pub trait MutPair {
    type Key;
    type Ret;
    fn mut_pair(
        &mut self,
        key1: Self::Key,
        key2: Self::Key
    ) -> Option<(&mut Self::Ret, &mut Self::Ret)>; }

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]);

Associated Types

type Key

type Ret

Loading content...

Required methods

fn mut_pair(
    &mut self,
    key1: Self::Key,
    key2: Self::Key
) -> Option<(&mut Self::Ret, &mut Self::Ret)>

Loading content...

Implementations on Foreign Types

impl<T> MutPair for [T][src]

type Key = usize

type Ret = T

impl<T> MutPair for Vec<T>[src]

type Key = usize

type Ret = T

impl<K: Eq + Hash, T> MutPair for HashMap<K, T>[src]

type Key = K

type Ret = T

impl<K: Ord + Hash, T> MutPair for BTreeMap<K, T>[src]

type Key = K

type Ret = T

Loading content...

Implementors

Loading content...