Skip to content

Commit

Permalink
add a new macro: eprint_msg
Browse files Browse the repository at this point in the history
  • Loading branch information
wlqm committed Mar 13, 2024
1 parent c9d4d8e commit d637db3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ruc"
version = "5.1.2"
version = "5.1.3"
authors = ["hui.fan@mail.ru"]
edition = "2021"
description = "Rust Util Collections"
Expand Down
12 changes: 12 additions & 0 deletions src/err/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ macro_rules! print_msg {
}};
}

/// eprint custom msg
#[macro_export]
macro_rules! eprint_msg {
($fmt: expr, $($arg:tt)*) => {{
println!("\n{}", $crate::d!($fmt, $($arg)*));
}};
($msg: expr) => {{
$crate::eprint_msg!("{}", $msg)
}};
}

/// Just a panic
#[macro_export]
macro_rules! die {
Expand Down Expand Up @@ -152,5 +163,6 @@ mod tests {
omit!(Err::<u8, _>(eg!()));
info_omit!(Err::<u8, _>(eg!()));
print_msg!("{:?}", ts!());
eprint_msg!("{:?}", ts!());
}
}

0 comments on commit d637db3

Please sign in to comment.