fn splicing_candidates(
        mut candidates: Candidates,
        sides: &Vec<Side>,
    ) -> (Candidates, Candidates) {
        let mut left_candidates = Candidates::with_capacity(candidates.len() / 2);
        let mut right_candidates = Candidates::with_capacity(candidates.len() / 2);

        for e in candidates.drain(..) {
            match sides[e.index] {
                Side::Left => left_candidates.push(e),
                Side::Right => right_candidates.push(e),
                Side::Both => {
                    right_candidates.push(e.clone());
                    left_candidates.push(e);
                }
            }
        }
        (left_candidates, right_candidates)
    }
// Step 2: Splicing candidates left and right subspace given items sides
Step 2: Splicing candidates left and right subspace given items sides
Step 2 : Splicing candidates left and right subspace given items sides
fn splicing_candidates(
        mut candidates: Candidates,
        sides: &Vec<Side>,
    ) -> (Candidates, Candidates) {
        let mut left_candidates = Candidates::with_capacity(candidates.len() / 2);
        let mut right_candidates = Candidates::with_capacity(candidates.len() / 2);
        for e in candidates.drain(..) {
            match sides[e.index] {
                Side::Left => left_candidates.push(e),
                Side::Right => right_candidates.push(e),
                Side::Both => {
                    right_candidates.push(e.clone());
                    left_candidates.push(e);
                }
            }
        }
        (left_candidates, right_candidates)
    }
fn splicing_candidates ( mut candidates : Candidates , sides : & Vec < Side > , ) -> ( Candidates , Candidates ) { let mut left_candidates = Candidates :: with_capacity ( candidates . len ( ) / 2 ) ; let mut right_candidates = Candidates :: with_capacity ( candidates . len ( ) / 2 ) ; for e in candidates . drain ( .. ) { match sides [ e . index ] { Side :: Left => left_candidates . push ( e ) , Side :: Right => right_candidates . push ( e ) , Side :: Both => { right_candidates . push ( e . clone ( ) ) ; left_candidates . push ( e ) ; } } } ( left_candidates , right_candidates ) }
Step 2: Splicing candidates left and right subspace given items sides
Step 2 : Splicing candidates left and right subspace given items sides
candidates
Candidates
sides
&Vec<Side>