| Crates.io | developer_debug_tools |
| lib.rs | developer_debug_tools |
| version | 0.1.1 |
| created_at | 2025-10-30 13:00:37.215651+00 |
| updated_at | 2025-10-31 07:09:08.248716+00 |
| description | Tools for developer to debug their code |
| homepage | |
| repository | https://gitlab.com/coderodent/developer_debug_tools |
| max_upload_size | |
| id | 1908223 |
| size | 43,356 |
The crate aids developers to their code e.g debug recurive function by printing the recursion tree of call
Annotate any recursive function with proc macro print_recursion_tree. Recursion tree is printed in the stdout
at the end of recursive call.
The pre condition is that all arguments and return type of the function must implement std::fmt::Debug trait
This macro depends on the below externa crates. Make sure to add it in your dependencies
use developer_debug_tools::print_recursion_tree;
#[print_recursion_tree(print_recursion_counter, print_each_pass)]
fn fibonacci_recursive(n: u16) -> u16 {
if n <= 1 {
return n;
} else {
return fibonacci_recursive(n - 1) + fibonacci_recursive(n - 2);
}
}
Output of fibonacci_recursive(3) is as below
fibonacci_recursive
└─ 3
├─ 2
│ ├─ 1
│ │ └─ =1
│ ├─ 0
│ │ └─ =0
│ └─ =1
├─ 1
│ └─ =1
└─ =2
fibonacci_recursive is the function name
└─3, └─2 denotes argument passed to the function
└─ =2, └─ =1 are the return value of each recursive call
Two flags(attributes) are supported by this proc-macro
This prints the recursion tree on each recursive call. If this flag is not provided, recursion tree is printed only once at the end of the recursion
This prints the total recursion calls evaluated. This can be useful to check the optimization of recursive call e.g using memoization
Total Number Of Recursions: 4