1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! A bunch of utlities I found myself needing over and over again.

#[macro_use]
extern crate derive_more;

#[macro_use]
mod macros;

#[cfg(feature = "log")]
#[doc(hidden)]
pub extern crate log;
#[cfg(feature = "packer")]
#[doc(hidden)]
pub extern crate packer;
#[cfg(feature = "warp")]
#[doc(hidden)]
pub extern crate warp as warp_;

pub mod errors;
#[cfg(feature = "futures")]
pub mod futures;
#[cfg(all(feature = "futures", feature = "warp"))]
pub mod warp;

/// Runs the given closure immediately. Mostly for use as replacement for `catch` blocks, which
/// seem to be taking a while to stabilize...
pub fn catch<F: FnOnce() -> T, T>(func: F) -> T {
    func()
}