[][src]Function ena::config::refresh_rate

pub fn refresh_rate(
    initial: u16,
    step_by: usize,
    take: usize
) -> Chain<Take<StepBy<RangeFrom<u16>>>, Repeat<u16>>

Create an iterator that mimics the thread refresh system

It repeats indefintely so take is required to limit how many step_by.
If the stream has reached or passed its last value, it will keep repeating that last value.
If an initial refreshDelay was set to 20, 5 is added to each and subsequent requests that return NOT_MODIFIED. If the next request is OK, the stream can be reset back to it's initial value by calling clone() on it.

Arguments

Example

use ena::config;
let orig = config::refresh_rate(20, 5, 10);
let mut rate = orig.clone();
rate.next(); // 20
rate.next(); // 25
rate.next(); // 30
//
/* continued calls to rate.next(); */
rate.next(); // 75
rate.next(); // 75 .. repeating

rate = orig.clone();
rate.next(); // 20