[][src]Trait cl_traits::Swap

pub trait Swap {
    type Input;
    type Output;
    fn swap(&mut self, input: Self::Input) -> Self::Output;
}

See Swap for more information.

Associated Types

type Input

Input

type Output

Output

Loading content...

Required methods

fn swap(&mut self, input: Self::Input) -> Self::Output

Swaps two elements referencied by Input.

Loading content...

Implementors

impl<'a, T> Swap for &'a mut [T][src]

let mut structure = &mut [1, 2, 3][..];
cl_traits::Swap::swap(&mut structure, (0, 2));
assert_eq!(structure.get(0), Some(&3));
assert_eq!(structure.get(2), Some(&1));

type Input = (usize, usize)

type Output = ()

impl<A> Swap for ArrayWrapper<A> where
    A: Array
[src]

let mut structure = cl_traits::doc_tests::array_wrapper();
cl_traits::Swap::swap(&mut structure, (0, 2));
assert_eq!(structure.get(0), Some(&3));
assert_eq!(structure.get(2), Some(&1));

type Input = (usize, usize)

type Output = ()

Loading content...