fn insert_color(
        &self, pairs: &mut HashMap<ColorPair, i16>, pair: ColorPair
    ) -> i16 {
        let n = 1 + pairs.len() as i16;
        let target = if ncurses::COLOR_PAIRS() > i32::from(n) {
            // We still have plenty of space for everyone.
            n
        } else {
            // The world is too small for both of us.
            let target = n - 1;
            // Remove the mapping to n-1
            pairs.retain(|_, &mut v| v != target);
            target
        };
        pairs.insert(pair, target);
        ncurses::init_pair(
            target,
            find_closest(&pair.front),
            find_closest(&pair.back),
        );
        target
    }
/// Save a new color pair.
Save a new color pair.
Save a new color pair .
fn insert_color(
        &self, pairs: &mut HashMap<ColorPair, i16>, pair: ColorPair
    ) -> i16 {
        let n = 1 + pairs.len() as i16;
        let target = if ncurses::COLOR_PAIRS() > i32::from(n) {
            // We still have plenty of space for everyone.
            n
        } else {
            // The world is too small for both of us.
            let target = n - 1;
            // Remove the mapping to n-1
            pairs.retain(|_, &mut v| v != target);
            target
        };
        pairs.insert(pair, target);
        ncurses::init_pair(
            target,
            find_closest(&pair.front),
            find_closest(&pair.back),
        );
        target
    }
fn insert_color ( & self , pairs : & mut HashMap < ColorPair , i16 > , pair : ColorPair ) -> i16 { let n = 1 + pairs . len ( ) as i16 ; let target = if ncurses :: COLOR_PAIRS ( ) > i32 :: from ( n ) { // We still have plenty of space for everyone. n } else { // The world is too small for both of us. let target = n - 1 ; // Remove the mapping to n-1 pairs . retain ( | _ , & mut v | v != target ) ; target } ; pairs . insert ( pair , target ) ; ncurses :: init_pair ( target , find_closest ( & pair . front ) , find_closest ( & pair . back ) , ) ; target }
Save a new color pair.
Save a new color pair .
&self
pairs
&mut HashMap<ColorPair, i16>
pair
ColorPair
&self
pairs
&mut HashMap<ColorPair, i16>
pair
ColorPair