Function pallet_election_provider_multi_phase::helpers::target_index_fn[][src]

pub fn target_index_fn<T: Config>(
    snapshot: &Vec<T::AccountId>
) -> impl Fn(&T::AccountId) -> Option<SolutionTargetIndexOf<T>> + '_
Expand description

Create a function that returns the index of a target in the snapshot.

The returned index type is the same as the one defined in T::Solution::Target.

Note: to the extent possible, the returned function should be cached and reused. Producing that function requires a O(n log n) data transform. Each invocation of that function completes in O(log n).