1 | #[cfg(feature = "std")] |
---|---|
2 | macro_rules! try_lock { |
3 | ($lock:expr) => { |
4 | try_lock!($lock, else return) |
5 | }; |
6 | ($lock:expr, else $els:expr) => { |
7 | if let Ok(l) = $lock { |
8 | l |
9 | } else if std::thread::panicking() { |
10 | $els |
11 | } else { |
12 | panic!("lock poisoned") |
13 | } |
14 | }; |
15 | } |
16 | |
17 | macro_rules! feature { |
18 | ( |
19 | #![$meta:meta] |
20 | $($item:item)* |
21 | ) => { |
22 | $( |
23 | #[cfg($meta)] |
24 | #[cfg_attr(docsrs, doc(cfg($meta)))] |
25 | $item |
26 | )* |
27 | } |
28 | } |
29 |