fn take_votes(&mut self,election_data:&'_ ElectionData,to_take:BallotPaperCount,where_to_go:&mut Vec<TakeVotes>) {
        let mut togo = to_take.0;
        assert!(togo <= self.ballots_remaining.0);
        let num_atl = election_data.atl.len();
        while togo>0 {
            let source = self.current_votes.pop().unwrap();
            let is_atl = source.0 < num_atl;
            let n = (if is_atl { election_data.atl[source.0].n } else { election_data.btl[source.0-num_atl].n})-self.used_from_last_of_current_votes;
            let n_to_use = n.min(togo);
            where_to_go.push(TakeVotes{ from: source, n:n_to_use });
            togo-=n_to_use;
            self.ballots_remaining-=BallotPaperCount(n_to_use);
            if n>n_to_use {
                self.current_votes.push(source);
                self.used_from_last_of_current_votes +=n_to_use;
            } else {
                self.used_from_last_of_current_votes =0;
            }
        }
    }
/// Get a specific number of ballots.
Get a specific number of ballots.
Get a specific number of ballots .
fn take_votes(&mut self,election_data:&'_ ElectionData,to_take:BallotPaperCount,where_to_go:&mut Vec<TakeVotes>) {
        let mut togo = to_take.0;
        assert!(togo <= self.ballots_remaining.0);
        let num_atl = election_data.atl.len();
        while togo>0 {
            let source = self.current_votes.pop().unwrap();
            let is_atl = source.0 < num_atl;
            let n = (if is_atl { election_data.atl[source.0].n } else { election_data.btl[source.0-num_atl].n})-self.used_from_last_of_current_votes;
            let n_to_use = n.min(togo);
            where_to_go.push(TakeVotes{ from: source, n:n_to_use });
            togo-=n_to_use;
            self.ballots_remaining-=BallotPaperCount(n_to_use);
            if n>n_to_use {
                self.current_votes.push(source);
                self.used_from_last_of_current_votes +=n_to_use;
            } else {
                self.used_from_last_of_current_votes =0;
            }
        }
    }
fn take_votes ( & mut self , election_data : & ' _ ElectionData , to_take : BallotPaperCount , where_to_go : & mut Vec < TakeVotes > ) { let mut togo = to_take . 0 ; assert ! ( togo self ballots_remaining 0 ) ; let num_atl = election_data . atl . len ( ) ; while togo > 0 { let source = self . current_votes . pop ( ) . unwrap ( ) ; let is_atl = source . 0 < num_atl ; let n = ( if is_atl { election_data . atl [ source . 0 ] . n } else { election_data . btl [ source . 0 - num_atl ] . n } ) - self . used_from_last_of_current_votes ; let n_to_use = n . min ( togo ) ; where_to_go . push ( TakeVotes { from : source , n : n_to_use } ) ; togo -= n_to_use ; self . ballots_remaining -= BallotPaperCount ( n_to_use ) ; if n > n_to_use { self . current_votes . push ( source ) ; self . used_from_last_of_current_votes += n_to_use ; } else { self . used_from_last_of_current_votes = 0 ; } } }
Get a specific number of ballots.
Get a specific number of ballots .
&mut self
election_data
&'_ ElectionData
to_take
BallotPaperCount
where_to_go
&mut Vec<TakeVotes>
&mut self
election_data
&'_ ElectionData
to_take
BallotPaperCount
where_to_go
&mut Vec<TakeVotes>