How to debug? #238
-
| I want to debug the rust code, how should I do it? Currently, I am calling it through  But, this method is very inefficient and it is not easy to find problems. | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
-
| It depends on the granularity of what you're trying to test, but you might want to try writing rust unit tests within the module you're trying to debug. To run a specific test you can specify the name of the function you defined: cargo test name_of_my_test_caseAnd if you want to make sure that any logging you do actually gets displayed in the console, include the  cargo test name_of_my_test_case -- --nocaptureFor things that can't be simulated entirely on the rust side I typically do as you describe: | 
Beta Was this translation helpful? Give feedback.
It depends on the granularity of what you're trying to test, but you might want to try writing rust unit tests within the module you're trying to debug. To run a specific test you can specify the name of the function you defined:
cargo test name_of_my_test_caseAnd if you want to make sure that any logging you do actually gets displayed in the console, include the
--nocaptureflag:cargo test name_of_my_test_case -- --nocaptureFor things that can't be simulated entirely on the rust side I typically do as you describe:
dbg!andprintln!to peek at values)makerule to do an un-optimized buildnode my-test-script.js