| Crates.io | debug_utilities |
| lib.rs | debug_utilities |
| version | 0.1.0 |
| created_at | 2025-08-20 12:41:39.359208+00 |
| updated_at | 2025-08-20 12:41:39.359208+00 |
| description | debug_utilities provides procedural macros to simplify code debugging |
| homepage | |
| repository | https://github.com/bjfssd757/debug-utilities |
| max_upload_size | |
| id | 1803349 |
| size | 8,472 |
Rust procedural macros for simplified debugging.
#[Trace] - An attribute for showing the input and output of a function, including the received parameters and the result of the function;dbg_here!(variable) - Macro for debugging the contents of a variable.First, you need to add the library to your project:
cargo add debug_utilities
Then, you need to add a dependency to highlight debug messages in the terminal:
cargo add colored
#[trace]Adds a debug output to the beginning and end of the function, showing the function entry (along with the input parameters) and exit (with the returned result, if any).
use debug_utilities::*;
#[trace]
fn get_name(id: i32) -> String {
if id == 0 {
println!("Not valid id");
"Invalid id".to_string()
} else {
println!("Valid id");
"Some Name".to_string()
}
}
fn main() {
let name = get_name(1);
println!("{}", name);
}
/* output:
--> Entering function: 'get_name'
Param 'id' = 1
Valid id
<-- Exiting function: 'get_name' with result: "Some Name"
Some Name
*/
dbg_here!(variable)Displays the value of the specified variable in the debug message.
use debug_utilities::*;
fn main() {
let a = 42;
dbg_here!(a);
}
/* output:
[example\src\main.rs:5] in example: 'a' = 42
*/