Function glib::source::timeout_add_seconds [] [src]

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

Sets a function to be called at regular intervals with the default priority, PRIORITY_DEFAULT.

The function is called repeatedly until it returns Continue(false), at which point the timeout is automatically destroyed and the function will not be called again.

Note that the first call of the timer may not be precise for timeouts of one second. If you need finer precision and have such a timeout, you may want to use timeout_add() instead.

The interval given is in terms of monotonic time, not wall clock time. See g_get_monotonic_time() in glib documentation.

Examples

timeout_add_seconds(10, || {
    println!("This prints once every 10 seconds");
    Continue(true)
});