1
0
mirror of https://github.com/jht5945/rust_util.git synced 2025-12-29 08:30:04 +08:00

add time, iff!

This commit is contained in:
2019-12-28 09:45:56 +08:00
parent 7d5bb125ba
commit c4c6273c38
3 changed files with 19 additions and 1 deletions

View File

@@ -13,6 +13,15 @@ pub mod util_cmd;
pub mod util_msg;
pub mod util_size;
pub mod util_file;
pub mod util_time;
/// iff!(condition, result_when_true, result_when_false)
#[macro_export]
macro_rules! iff {
($c:expr, $t:expr, $f:expr) => {
if $c { $t } else { $f }
};
}
pub type XResult<T> = Result<T, Box<dyn std::error::Error>>;