[feature] short name: only returns the function name

This commit is contained in:
ddidderr 2024-02-26 11:41:31 +01:00
parent ec277110e5
commit e63189514f
Signed by: ddidderr
GPG Key ID: 3841F1C27E6F0E14

View File

@ -14,6 +14,15 @@ macro_rules! function_name {
}}; }};
} }
/// Only get the function name itself, not the full qualifier
#[macro_export]
macro_rules! function_name_short {
() => {{
let name = function_name!();
name.split("::").last().unwrap()
}};
}
/// Like [`println!`] but also prints the current function name (including module path) and line. /// Like [`println!`] but also prints the current function name (including module path) and line.
/// ///
/// # Examples /// # Examples