1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![cfg_attr(docsrs, allow(unused_attributes))]
3
4#[macro_use]
10extern crate captains_log;
11mod client;
12pub use client::*;
13mod server;
14pub use server::*;
15
16#[macro_export(local_inner_macros)]
17macro_rules! io_with_timeout {
18 ($IO: path, $timeout: expr, $f: expr) => {{
19 if $timeout == Duration::from_secs(0) {
20 $f.await
21 } else {
22 match <$IO as orb::time::AsyncTime>::timeout($timeout, $f).await {
24 Ok(Ok(r)) => Ok(r),
25 Ok(Err(e)) => Err(e),
26 Err(_) => Err(std::io::ErrorKind::TimedOut.into()),
27 }
28 }
29 }};
30}