Function glib::source::idle_add [] [src]

pub fn idle_add<F>(func: F) -> u32 where F: FnMut() -> Continue + 'static

Adds a function to be called whenever there are no higher priority events pending to the default main loop.

The function is given the default idle priority, PRIORITY_DEFAULT_IDLE. If the function returns Continue(false) it is automatically removed from the list of event sources and will not be called again.

Examples

let mut i = 0;
idle_add(move || {
    println!("Idle: {}", i);
    i += 1;
    Continue(if i <= 10 { true } else { false })
});