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

feat: add failure and exit

This commit is contained in:
2021-05-22 13:32:15 +08:00
parent b91e6e060a
commit b4c789aebc
2 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "rust_util" name = "rust_util"
version = "0.6.32" version = "0.6.33"
authors = ["Hatter Jiang <jht5945@gmail.com>"] authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018" edition = "2018"
description = "Hatter's Rust Util" description = "Hatter's Rust Util"

View File

@@ -40,6 +40,12 @@ pub mod util_tlv;
#[macro_export] macro_rules! debugging { #[macro_export] macro_rules! debugging {
($($arg:tt)+) => ( rust_util::util_msg::print_debug(&format!($($arg)+)); ) ($($arg:tt)+) => ( rust_util::util_msg::print_debug(&format!($($arg)+)); )
} }
#[macro_export] macro_rules! failure_and_exit {
($($arg:tt)+) => ( {
rust_util::util_msg::print_error(&format!($($arg)+));
std::process::exit(-1);
} )
}
#[macro_export] macro_rules! opt_value { #[macro_export] macro_rules! opt_value {
($ex: expr) => ( match $ex { Some(o) => o, None => return, } ) ($ex: expr) => ( match $ex { Some(o) => o, None => return, } )
} }