fn give_to_candidate<Rules:PreferenceDistributionRules>(&mut self, amount:Rules::Tally, recipient:CandidateIndex, changes:&mut VoteChanges<Rules::Tally>,may_be_atl:bool) -> bool {
        let mut togo = amount;
        while togo>Rules::Tally::zero() {
            if let Some(available) = if may_be_atl { self.available_to_take_atl_ok::<Rules>() } else { self.available_to_take_btl_only::<Rules>() } {
                let parcel = togo.clone().min(available);
                let index_currently_taking_from = if may_be_atl {self.index_currently_taking_from_atl_ok} else { self.index_currently_taking_from_btl_only};
                changes.transfer(parcel.clone(),self.from_sources[index_currently_taking_from],recipient);
                if self.available_to_take_from_sources[index_currently_taking_from].get_votes::<Rules>(parcel.clone(),may_be_atl).is_none() { return false; } // unlikely
                togo-=parcel.clone();
            } else { return false; }
        }
        true
    }
/// Try to give a certain amount of votes to a given recipient, return true iff success.
Try to give a certain amount of votes to a given recipient, return true iff success.
Try to give a certain amount of votes to a given recipient return true iff success .
fn give_to_candidate<Rules:PreferenceDistributionRules>(&mut self, amount:Rules::Tally, recipient:CandidateIndex, changes:&mut VoteChanges<Rules::Tally>,may_be_atl:bool) -> bool {
        let mut togo = amount;
        while togo>Rules::Tally::zero() {
            if let Some(available) = if may_be_atl { self.available_to_take_atl_ok::<Rules>() } else { self.available_to_take_btl_only::<Rules>() } {
                let parcel = togo.clone().min(available);
                let index_currently_taking_from = if may_be_atl {self.index_currently_taking_from_atl_ok} else { self.index_currently_taking_from_btl_only};
                changes.transfer(parcel.clone(),self.from_sources[index_currently_taking_from],recipient);
                if self.available_to_take_from_sources[index_currently_taking_from].get_votes::<Rules>(parcel.clone(),may_be_atl).is_none() { return false; } // unlikely
                togo-=parcel.clone();
            } else { return false; }
        }
        true
    }
fn give_to_candidate < Rules : PreferenceDistributionRules > ( & mut self , amount : Rules :: Tally , recipient : CandidateIndex , changes : & mut VoteChanges < Rules :: Tally > , may_be_atl : bool ) -> bool { let mut togo = amount ; while togo > Rules :: Tally :: zero ( ) { if let Some ( available ) = if may_be_atl { self . available_to_take_atl_ok :: < Rules > ( ) } else { self . available_to_take_btl_only :: < Rules > ( ) } { let parcel = togo . clone ( ) . min ( available ) ; let index_currently_taking_from = if may_be_atl { self . index_currently_taking_from_atl_ok } else { self . index_currently_taking_from_btl_only } ; changes . transfer ( parcel . clone ( ) , self . from_sources [ index_currently_taking_from ] , recipient ) ; if self . available_to_take_from_sources [ index_currently_taking_from ] . get_votes :: < Rules > ( parcel . clone ( ) , may_be_atl ) . is_none ( ) { return false ; } // unlikely togo -= parcel . clone ( ) ; } else { return false ; } } true }
Try to give a certain amount of votes to a given recipient, return true iff success.
Try to give a certain amount of votes to a given recipient return true iff success .
&mut self
amount
Rules::Tally
recipient
CandidateIndex
changes
&mut VoteChanges<Rules::Tally>
may_be_atl
bool
&mut self
amount
Rules::Tally
recipient
CandidateIndex
changes
&mut VoteChanges<Rules::Tally>
may_be_atl
bool