tools.rs: new try_block macro

This commit is contained in:
Dietmar Maurer 2019-02-15 10:59:12 +01:00
parent 1d77b6cf6b
commit f0dbba8cbe

View File

@ -27,6 +27,11 @@ pub mod ticket;
pub mod borrow;
pub mod fs;
#[macro_export]
macro_rules! try_block {
{ $($token:tt)* } => {{ (|| -> Result<_,_> { $($token)* })() }}
}
/// The `BufferedReader` trait provides a single function
/// `buffered_read`. It returns a reference to an internal buffer. The
/// purpose of this traid is to avoid unnecessary data copies.