Cargo run --watch flag to auto recompile

Hi, i'm thinking about in adding this --watch flag in cargo run command to be able to recompile the code when something changes in the app or package code like we usually do when developing a webserver in nodejs world. What should i know beforehand? There is something that were already done in this regard? I searched about it but it seems that no one talked about it yet but there is a cargo crate that does somehting similar (cargo-watch) but i think this feature would integrate well in native cargo tooling.

cargo watch exists and there is an issue for adding it to cargo.

Something to keep in mind is that the cargo team is stretched thin and new features mean more workload for the cargo team so we are on a soft feature freeze. The best route to getting a new feature in is to take an extra dose of responsibility on yourself to ensure its success (e.g. being able to take vague instructions and run with them) and to show you are willing to support it longer term. Have proposals upfront and ready for review in the Issue and once you have buy-in, then move on to the PR. Even with this, it still might not make much headway, depending on how the team is doing.

3 Likes

Sorry, i wasn't very clear that i wanted to implement this into cargo. Do you have any design considerations or something related?

By "adding" cargo watch to cargo, I think integrating it as a --watch flag is included in that. Probably first thing is a thorough understanding of cargo watch and what works well and doesn't. Besides having a general idea that you want this, we need an understanding of what that means in practice. The discussion should likely continue on that linked issue.

2 Likes

Ok, moving the conversation to the mentioned issue