1#[macro_export]
6macro_rules! retry {
7 ($e:expr) => (
8 loop {
9 match $e {
10 Ok(t) => break t,
11 Err(ref e) if e.kind() == ::std::io::ErrorKind::Interrupted => {}
12 Err(e) => return Err(e.into()),
13 }
14 }
15 )
16}
17
18#[macro_export]
21macro_rules! read_nz {
22 ($e:expr, $msg:expr) => (
23 match $e {
24 Ok(::futures_core::Async::Ready(0)) => return Err(::futures_io::Error::new(::futures_io::ErrorKind::UnexpectedEof, $msg).into()),
25 Ok(::futures_core::Async::Ready(read)) => read,
26 Ok(::futures_core::Async::Pending) => return Ok(::futures_core::Async::Pending),
27 Err(e) => return Err(From::from(e)),
28 }
29 )
30}
31
32#[macro_export]
35macro_rules! write_nz {
36 ($e:expr, $msg:expr) => (
37 match $e {
38 Ok(::futures_core::Async::Ready(0)) => return Err(::futures_io::Error::new(::futures_io::ErrorKind::WriteZero, $msg).into()),
39 Ok(::futures_core::Async::Ready(written)) => written,
40 Ok(::futures_core::Async::Pending) => return Ok(::futures_core::Async::Pending),
41 Err(e) => return Err(From::from(e)),
42 }
43 )
44}