pub fn average_lagging_behind(&self) -> u64 {
        let (pongs_count, lagging_behind_sum) = self.data.iter().fold(
            (0, 0),
            |(mut pongs_count, mut lagging_behind_sum), ping_pong| {
                if let Some(pong) = &ping_pong.pong {
                    pongs_count += 1;
                    lagging_behind_sum += pong
                        .received_frame
                        .saturating_sub(pong.estimated_peer_frame_number);
                }
                (pongs_count, lagging_behind_sum)
            },
        );
        if pongs_count == 0 {
            if self.data.len() < PING_PONG_STORAGE_LIMIT / 2 {
                0
            } else {
                u64::max_value()
            }
        } else {
            lagging_behind_sum / pongs_count
        }
    }
/// Returns 0 if a level has just started and we have little data, otherwise returns u64::max()
/// if there're no pongs at all.
/// This usually evaluates to 0 on client side.
Returns 0 if a level has just started and we have little data, otherwise returns u64::max()
if there're no pongs at all.
This usually evaluates to 0 on client side.
Returns 0 if a level has just started and we have little data otherwise returns u64 :: max () if there ' re no pongs at all . This usually evaluates to 0 on client side .
pub fn average_lagging_behind(&self) -> u64 {
        let (pongs_count, lagging_behind_sum) = self.data.iter().fold(
            (0, 0),
            |(mut pongs_count, mut lagging_behind_sum), ping_pong| {
                if let Some(pong) = &ping_pong.pong {
                    pongs_count += 1;
                    lagging_behind_sum += pong
                        .received_frame
                        .saturating_sub(pong.estimated_peer_frame_number);
                }
                (pongs_count, lagging_behind_sum)
            },
        );
        if pongs_count == 0 {
            if self.data.len() < PING_PONG_STORAGE_LIMIT / 2 {
                0
            } else {
                u64::max_value()
            }
        } else {
            lagging_behind_sum / pongs_count
        }
    }
pub fn average_lagging_behind ( & self ) -> u64 { let ( pongs_count , lagging_behind_sum ) = self . data . iter ( ) . fold ( ( 0 , 0 ) , | ( mut pongs_count , mut lagging_behind_sum ) , ping_pong | { if let Some ( pong ) = & ping_pong . pong { pongs_count += 1 ; lagging_behind_sum += pong . received_frame . saturating_sub ( pong . estimated_peer_frame_number ) ; } ( pongs_count , lagging_behind_sum ) } , ) ; if pongs_count == 0 { if self . data . len ( ) < PING_PONG_STORAGE_LIMIT / 2 { 0 } else { u64 :: max_value ( ) } } else { lagging_behind_sum / pongs_count } }
Returns 0 if a level has just started and we have little data, otherwise returns u64::max()
if there're no pongs at all.
Returns 0 if a level has just started and we have little data otherwise returns u64 :: max () if there ' re no pongs at all .
&self