use std::{thread, time::Duration};
fn main() {
let on_tick = || {
println!("tick!");
};
let static_on_tick = Box::leak(Box::new(on_tick));
let cancel = spawn_interval::spawn_interval(static_on_tick, Duration::from_millis(500));
thread::sleep(Duration::from_secs(3));
cancel();
println!("This instance of spawn_interval has been succesfully stopped");
thread::sleep(Duration::from_millis(u64::MAX));
}