Skip to content

chore: extract shared render, watcher, and HMR modules#47

Merged
janechu merged 2 commits into
mainfrom
users/janechu/share-hmr-code
Feb 23, 2026
Merged

chore: extract shared render, watcher, and HMR modules#47
janechu merged 2 commits into
mainfrom
users/janechu/share-hmr-code

Conversation

@janechu

@janechu janechu commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Moved render.rs, watcher.rs, and HMR version logic into examples/shared/rust/ so both the tiny_http and hyper integration examples reference a single copy via #[path] includes
  • Extracted hmr_version() as a shared pure function in examples/shared/rust/hmr.rs, replacing duplicated inline logic in each example's routes/hmr.rs
  • Deleted the local render.rs and watcher.rs from both integration examples (net removal of ~350 lines of duplicated code)

Test plan

  • cargo build succeeds for both tiny_http and hyper examples
  • cargo clippy -- -D warnings passes for both examples
  • Manual test: cd examples/integration/tiny_http && cargo run -- --app hello-world serves correctly
  • Manual test: cd examples/integration/hyper && cargo run -- --app hello-world serves correctly
  • HMR polling (/hmr endpoint) returns version timestamps in both examples

🤖 Generated with Claude Code

Move render.rs, watcher.rs, and HMR version logic into
examples/shared/rust/ so both tiny_http and hyper integration
examples reference a single copy via #[path] includes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mohamedmansour
mohamedmansour previously approved these changes Feb 23, 2026
@janechu janechu merged commit 2ec3a02 into main Feb 23, 2026
5 checks passed
@mohamedmansour mohamedmansour deleted the users/janechu/share-hmr-code branch February 24, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants