#Cannot move housekeeping items out of main for timed template

2 messages · Page 1 of 1 (latest)

stray egret
#

what about

fn main() {
    let start = housekeeping_open();

    println!("Hello, world!");

    housekeeping_close(start);
}
safe mango
#

Best to go with the above solution and avoid the need for global state, however if you do still want global state you can use something like OnceLock to store the Instant in a static