Insert Code to Leetcode Generated Code
When I wrote leetcode in vscode with the plugin, I named generated leetcode file with format as[0-9]+
(e.g, as123.rs
) and put them under src
. However, I have encountered some painpoints:
- The generated file isn't used by
main.rs
so the rust analyzer will ignore it, so I need to addmod as123;
inmain.rs
every time. - The generated code doesn't contain
struct Soltuion
definition so I need to add it every time. - When I want to debug locally, I need to write the test function from scratch. It doesn't cost much but it's verbose.
These painpoints are trivial, but they're quite verbose. By using build script build.rs
, I'm succeeded solving my painpoints!