developer_debug_tools

Crates.iodeveloper_debug_tools
lib.rsdeveloper_debug_tools
version0.1.1
created_at2025-10-30 13:00:37.215651+00
updated_at2025-10-31 07:09:08.248716+00
descriptionTools for developer to debug their code
homepage
repositoryhttps://gitlab.com/coderodent/developer_debug_tools
max_upload_size
id1908223
size43,356
(senthil-veerabahu)

documentation

https://docs.rs/developer_debug_tools

README

developer_debug_tools License developer_debug_tools on crates.io developer_debug_tools on docs.rs Source Code Repository

developer_debug_tools

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

  1. https://crates.io/crates/lazy_static
  2. https://crates.io/crates/ptree
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

1. print_each_pass

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

2.print_recursion_counter

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
Commit count: 0

cargo fmt