pub fn iter_source_ports_for_shard(&self, shard: Shard) -> impl Iterator<Item = u16> {
        assert!(shard < self.nr_shards.get() as u32);

        // Randomly choose a port to start at
        let starting_port = self.draw_source_port_for_shard(shard);

        // Choose smallest available port number to begin at after wrapping
        // apply the formula from draw_source_port_for_shard for lowest possible gen_range result
        let first_valid_port = (49152 + self.nr_shards.get() - 1) / self.nr_shards.get()
            * self.nr_shards.get()
            + shard as u16;

        let before_wrap = (starting_port..=65535).step_by(self.nr_shards.get().into());
        let after_wrap = (first_valid_port..starting_port).step_by(self.nr_shards.get().into());

        before_wrap.chain(after_wrap)
    }
/// Returns iterator over source ports `p` such that `shard == shard_of_source_port(p)`.
/// Starts at a random port and goes forward by `nr_shards`. After reaching maximum wraps back around.
/// Stops once all possibile ports have been returned
Returns iterator over source ports `p` such that `shard == shard_of_source_port(p)`.
Starts at a random port and goes forward by `nr_shards`. After reaching maximum wraps back around.
Stops once all possibile ports have been returned
Returns iterator over source ports ` p ` such that ` shard == shard_of_source_port ( p ) ` . Starts at a random port and goes forward by ` nr_shards ` . After reaching maximum wraps back around . Stops once all possibile ports have been returned
pub fn iter_source_ports_for_shard(&self, shard: Shard) -> impl Iterator<Item = u16> {
        assert!(shard < self.nr_shards.get() as u32);
        // Randomly choose a port to start at
        let starting_port = self.draw_source_port_for_shard(shard);
        // Choose smallest available port number to begin at after wrapping
        // apply the formula from draw_source_port_for_shard for lowest possible gen_range result
        let first_valid_port = (49152 + self.nr_shards.get() - 1) / self.nr_shards.get()
            * self.nr_shards.get()
            + shard as u16;
        let before_wrap = (starting_port..=65535).step_by(self.nr_shards.get().into());
        let after_wrap = (first_valid_port..starting_port).step_by(self.nr_shards.get().into());
        before_wrap.chain(after_wrap)
    }
pub fn iter_source_ports_for_shard ( & self , shard : Shard ) -> impl Iterator < Item = u16 > { assert ! ( shard self nr_shards get ( ) as u32 ) ; // Randomly choose a port to start at let starting_port = self . draw_source_port_for_shard ( shard ) ; // Choose smallest available port number to begin at after wrapping // apply the formula from draw_source_port_for_shard for lowest possible gen_range result let first_valid_port = ( 49152 + self . nr_shards . get ( ) - 1 ) / self . nr_shards . get ( ) * self . nr_shards . get ( ) + shard as u16 ; let before_wrap = ( starting_port ..= 65535 ) . step_by ( self . nr_shards . get ( ) . into ( ) ) ; let after_wrap = ( first_valid_port .. starting_port ) . step_by ( self . nr_shards . get ( ) . into ( ) ) ; before_wrap . chain ( after_wrap ) }
Returns iterator over source ports `p` such that `shard == shard_of_source_port(p)`.
Returns iterator over source ports ` p ` such that ` shard == shard_of_source_port ( p ) ` .
&self
shard
Shard
&self
shard
Shard