MCPcopy Create free account
hub / github.com/dfinity/orbit / set_timer

Function set_timer

libs/orbit-essentials/src/timers.rs:19–25  ·  view source on GitHub ↗
(_duration: Duration, callback: impl FnOnce() + Send + 'static)

Source from the content-addressed store, hash-verified

17 pub type TimerId = u64;
18
19 pub fn set_timer(_duration: Duration, callback: impl FnOnce() + Send + 'static) -> TimerId {
20 TIMERS.with(|timers| {
21 let timer_id = timers.borrow().last().map(|(id, _)| id).unwrap_or(&0) + 1;
22 timers.borrow_mut().push((timer_id, Box::new(callback)));
23 timer_id
24 })
25 }
26
27 pub fn clear_timer(timer_id: TimerId) {
28 TIMERS.with(|timers| {

Callers 6

scheduleMethod · 0.85
initialize_rng_timerMethod · 0.85
initialize_rng_timerFunction · 0.85
init_timers_fnFunction · 0.85

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected