pub async fn run_dev(addr: &str) -> Result<()>Expand description
Run the development server with automatic hot-reload.
§Behaviour
- Spawns
cargo run -- serve --addr <addr>as a child process. - Watches
./srcforCreate,Modify, orRemoveevents via thenotifycrate. - On change: kills the running child, waits for it to exit, drains any burst of additional events (300 ms debounce), and re-spawns.
- If the child exits on its own (e.g. compile error), the loop waits for the next file-change event before attempting to restart, avoiding a tight CPU-burning restart loop.
§Limitations
Because Rust is AOT-compiled, “hot reload” here means recompilation and
process restart — not in-process code swapping. Use RUST_LOG=info for
structured log output during development.