1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
use std::thread;
use std::time::Duration;
/// Update is a function that calls or "updates" another function
pub fn update(duration: Duration, function: fn()) {
function();
thread::sleep(duration);
update(duration, function);
}
// Update_True is a function that calls or "updates" another function if a bool is true
pub fn update_true(duration: Duration, statement: bool, function: fn()) {
if statement == true {
function();
thread::sleep(duration);
update_true(duration, statement, function)
}
else{ return; }
}