fn pick_initial_nodes<'a, I>(sorted_nodes: I) -> [(NodeHandle, bool); INITIAL_PICK_NUM]
where
    I: Iterator<Item = &'a mut (Distance, NodeHandle, bool)>,
{
    let dummy_id = [0u8; NODE_ID_LEN].into();
    let default = (
        NodeHandle::new(dummy_id, SocketAddr::from((Ipv4Addr::UNSPECIFIED, 0))),
        false,
    );

    let mut pick_nodes = [default; INITIAL_PICK_NUM];
    for (src, dst) in sorted_nodes.zip(pick_nodes.iter_mut()) {
        dst.0 = src.1;
        dst.1 = true;

        // Mark that the node has been requested from
        src.2 = true;
    }

    pick_nodes
}
/// Picks a number of nodes from the sorted distance iterator to ping on the first round.
Picks a number of nodes from the sorted distance iterator to ping on the first round.
Picks a number of nodes from the sorted distance iterator to ping on the first round .
fn pick_initial_nodes<'a, I>(sorted_nodes: I) -> [(NodeHandle, bool); INITIAL_PICK_NUM]
where
    I: Iterator<Item = &'a mut (Distance, NodeHandle, bool)>,
{
    let dummy_id = [0u8; NODE_ID_LEN].into();
    let default = (
        NodeHandle::new(dummy_id, SocketAddr::from((Ipv4Addr::UNSPECIFIED, 0))),
        false,
    );
    let mut pick_nodes = [default; INITIAL_PICK_NUM];
    for (src, dst) in sorted_nodes.zip(pick_nodes.iter_mut()) {
        dst.0 = src.1;
        dst.1 = true;
        // Mark that the node has been requested from
        src.2 = true;
    }
    pick_nodes
}
fn pick_initial_nodes < ' a , I > ( sorted_nodes : I ) -> [ ( NodeHandle , bool ) ; INITIAL_PICK_NUM ] where I : Iterator < Item = & ' a mut ( Distance , NodeHandle , bool ) > , { let dummy_id = [ 0u8 ; NODE_ID_LEN ] . into ( ) ; let default = ( NodeHandle :: new ( dummy_id , SocketAddr :: from ( ( Ipv4Addr :: UNSPECIFIED , 0 ) ) ) , false , ) ; let mut pick_nodes = [ default ; INITIAL_PICK_NUM ] ; for ( src , dst ) in sorted_nodes . zip ( pick_nodes . iter_mut ( ) ) { dst . 0 = src . 1 ; dst . 1 = true ; // Mark that the node has been requested from src . 2 = true ; } pick_nodes }
Picks a number of nodes from the sorted distance iterator to ping on the first round.
Picks a number of nodes from the sorted distance iterator to ping on the first round .
sorted_nodes
I
sorted_nodes
I