fn sorted_peers_and_index<S: std::hash::BuildHasher>(
        &self,
        stakes: Option<&HashMap<Pubkey, u64, S>>,
    ) -> (usize, Vec<ContactInfo>) {
        let mut peers = self.retransmit_peers();
        peers.push(self.lookup(&self.id()).unwrap().clone());
        let contacts_and_stakes: Vec<_> = ClusterInfo::sort_by_stake(&peers, stakes);
        let mut index = 0;
        let peers: Vec<_> = contacts_and_stakes
            .into_iter()
            .enumerate()
            .filter_map(|(i, (_, peer))| {
                if peer.id == self.id() {
                    index = i;
                    None
                } else {
                    Some(peer)
                }
            })
            .collect();
        (index, peers)
    }
/// Return sorted Retransmit peers and index of `Self.id()` as if it were in that list
Return sorted Retransmit peers and index of `Self.id()` as if it were in that list
Return sorted Retransmit peers and index of ` Self . id () ` as if it were in that list
fn sorted_peers_and_index<S: std::hash::BuildHasher>(
        &self,
        stakes: Option<&HashMap<Pubkey, u64, S>>,
    ) -> (usize, Vec<ContactInfo>) {
        let mut peers = self.retransmit_peers();
        peers.push(self.lookup(&self.id()).unwrap().clone());
        let contacts_and_stakes: Vec<_> = ClusterInfo::sort_by_stake(&peers, stakes);
        let mut index = 0;
        let peers: Vec<_> = contacts_and_stakes
            .into_iter()
            .enumerate()
            .filter_map(|(i, (_, peer))| {
                if peer.id == self.id() {
                    index = i;
                    None
                } else {
                    Some(peer)
                }
            })
            .collect();
        (index, peers)
    }
fn sorted_peers_and_index < S : std :: hash :: BuildHasher > ( & self , stakes : Option < & HashMap < Pubkey , u64 , S > > , ) -> ( usize , Vec < ContactInfo > ) { let mut peers = self . retransmit_peers ( ) ; peers . push ( self . lookup ( & self . id ( ) ) . unwrap ( ) . clone ( ) ) ; let contacts_and_stakes : Vec < _ > = ClusterInfo :: sort_by_stake ( & peers , stakes ) ; let mut index = 0 ; let peers : Vec < _ > = contacts_and_stakes . into_iter ( ) . enumerate ( ) . filter_map ( | ( i , ( _ , peer ) ) | { if peer . id == self . id ( ) { index = i ; None } else { Some ( peer ) } } ) . collect ( ) ; ( index , peers ) }
Return sorted Retransmit peers and index of `Self.id()` as if it were in that list
Return sorted Retransmit peers and index of ` Self . id () ` as if it were in that list
&self
stakes
Option<&HashMap<Pubkey, u64, S>>
&self
stakes
Option<&HashMap<Pubkey, u64, S>>