| Crates.io | workspacer-watch-and-reload |
| lib.rs | workspacer-watch-and-reload |
| version | 0.1.3 |
| created_at | 2025-04-01 21:07:33.807942+00 |
| updated_at | 2025-07-13 04:29:07.751714+00 |
| description | An asynchronous Rust crate for watching file changes and reloading Rust workspaces and crates. Detects changes in Cargo.toml and src/, executing custom rebuilds or tests. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1615580 |
| size | 188,971 |
workspacer-watch-and-reload is a Rust crate enabling efficient file-watching and automatic reloading capabilities within Rust workspaces and crates. Built with an emphasis on asynchronous execution, this crate ensures high responsiveness to file system changes, facilitating automated rebuilds or tests upon detection of significant modifications.
Cargo.toml and the src/ directories.CommandRunner implementations to execute custom rebuild or test commands upon file changes.WatchAndReloadImplement the WatchAndReload trait to define how a concrete type should respond to filesystem changes.
#[async_trait]
impl WatchAndReload for MyCrate {
type Error = MyError;
async fn watch_and_reload<'a>(&self, tx: Option<mpsc::Sender<Result<(), Self::Error>>>, runner: Arc<dyn CommandRunner + Send + Sync + 'a>, cancel_token: CancellationToken) -> Result<(), Self::Error> {
// Implementation
}
async fn is_relevant_change(&self, path: &Path) -> bool {
// Implementation
}
}
setup_file_watching
Initialize and configure file watching capabilities.watch_loop
Continuously monitors for changes, executing the necessary rebuilds or tests.Add the following to your Cargo.toml:
[dependencies]
workspacer-watch-and-reload = "0.1.0"
This project is licensed under the MIT License.