]> git.proxmox.com Git - pxar.git/blob - src/macros.rs
don't hold temp buffer mutex across await point
[pxar.git] / src / macros.rs
1 /// Like failure's `format_err` but producing a `std::io::Error`.
2 macro_rules! io_format_err {
3 ($($msg:tt)+) => {
4 ::std::io::Error::new(::std::io::ErrorKind::Other, format!($($msg)+))
5 };
6 }
7
8 /// Like failure's `bail` but producing a `std::io::Error`.
9 macro_rules! io_bail {
10 ($($msg:tt)+) => {{
11 return Err(io_format_err!($($msg)+));
12 }};
13 }
14
15 /// Our dependency on `futures` is optional.
16 macro_rules! ready {
17 ($expr:expr) => {{
18 match $expr {
19 std::task::Poll::Ready(r) => r,
20 std::task::Poll::Pending => return std::task::Poll::Pending,
21 }
22 }};
23 }