11use crate :: {
2- Fraction ,
3- structs:: { CandidateNumber , CandidateVotes , ListNumber } ,
2+ CandidateVotesTrait , Fraction ,
3+ structs:: { CandidateNumber , ListNumber } ,
44} ;
55
66/// Contains information about the chosen candidates and
77/// the candidate list ranking for a specific list.
88#[ derive( Debug , PartialEq ) ]
9- pub struct ListCandidateNomination {
9+ pub struct ListCandidateNomination < ' a , T : CandidateVotesTrait > {
1010 /// List number for which this nomination applies
1111 pub list_number : ListNumber ,
1212 /// The number of seats assigned to this group
1313 pub list_seats : u32 ,
1414 /// The list of chosen candidates via preferential votes, can be empty
15- pub preferential_candidate_nomination : Vec < CandidateVotes > ,
15+ // TODO: check lifetimes
16+ pub preferential_candidate_nomination : Vec < & ' a T > ,
1617 /// The list of other chosen candidates, can be empty
17- pub other_candidate_nomination : Vec < CandidateVotes > ,
18+ pub other_candidate_nomination : Vec < & ' a T > ,
1819 /// The updated ranking of the whole candidate list, can be empty
1920 pub updated_candidate_ranking : Vec < CandidateNumber > ,
2021}
@@ -33,13 +34,13 @@ pub struct PreferenceThreshold {
3334/// It also contains the preferential nomination of candidates, the remaining
3435/// nomination of candidates and the final ranking of candidates for each list.
3536#[ derive( Debug , PartialEq ) ]
36- pub struct CandidateNominationResult {
37+ pub struct CandidateNominationResult < ' a , T : CandidateVotesTrait > {
3738 /// Preference threshold percentage and number of votes
3839 pub preference_threshold : PreferenceThreshold ,
3940 /// List of chosen candidates
4041 pub chosen_candidates : Vec < Candidate > ,
4142 /// List of chosen candidates and candidate list ranking per list
42- pub list_candidate_nomination : Vec < ListCandidateNomination > ,
43+ pub list_candidate_nomination : Vec < ListCandidateNomination < ' a , T > > ,
4344}
4445
4546#[ derive( Debug , PartialEq ) ]
0 commit comments