lunatic 0.12.1

Helper library for building Rust applications that run on lunatic.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::host;

/// A reference to a timer created from send_after.
#[derive(Clone, Copy)]
pub struct TimerRef(u64);

impl TimerRef {
    pub(crate) fn new(timer_id: u64) -> Self {
        TimerRef(timer_id)
    }

    /// Cancel the timer, blocking until the timer is canceled.
    pub fn cancel(self) -> bool {
        unsafe { host::api::timer::cancel_timer(self.0) == 1 }
    }
}