async_timer/
utils.rs

1#[doc(hidden)]
2#[macro_export]
3#[cfg(not(debug_assertions))]
4macro_rules! unreach {
5    () => ({
6        unsafe {
7            core::hint::unreachable_unchecked();
8        }
9    })
10}
11
12#[doc(hidden)]
13#[macro_export]
14#[cfg(debug_assertions)]
15macro_rules! unreach {
16    () => ({
17        unreachable!()
18    })
19}
20
21///Assertion macro, which panics with last OS error
22///
23///With `no_std` equal to `assert!`
24#[cfg(not(feature = "no_std"))]
25macro_rules! os_assert {
26    ($cond:expr) => ({
27        if !($cond) {
28            panic!("Assertion '{}' failed. OS error: {:?}", stringify!($cond), std::io::Error::last_os_error());
29        }
30    })
31}
32
33#[cfg(feature = "no_std")]
34macro_rules! os_assert {
35    ($cond:expr) => ({
36        assert!($cond);
37    })
38}