Merged
Conversation
2ad0097 to
6a1e3a6
Compare
Thanks to `subsecond` by the Dioxus folks!
6a1e3a6 to
699b857
Compare
Contributor
|
Based. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a very, very experimental approach for hot reloading.
It leverages a new tech that the folks from the Dioxus toolkit came up with called
subsecond. It performs hotpatching of Rust binaries at runtime, similar to how some malware operates.Controversy
The recommended way to use this new tech is through Dioxus' opinionated CLI tool and dev server protocol:
dioxus-cli. However, I personally lovecargoand do not want to give it up; which is why I ported most of their technology into a generic tool:cargo-hot.This did spur some controversy and discussion in a Bevy issue, as the authors of
subsecondfelt I was ripping out their code. I will reiterate here that I have no plans on hard-forkingsubsecondnor competing directly with it and, furthermore, I will do my best to port any considerable improvements that land incargo-hotback todioxus-cli.Usage
The hot reloading client will be active when the
hotfeature flag is enabled. However, the build system needs to build and send patches to the executable; so a new build command is needed.Let's assume you define a
debugfeature in yourCargo.tomlthat enables thehotfeature:First, you must install
cargo-hot:cargo-hotis meant to be a drop-in replacement forcargo run, so if you were running your project with:You can simply replace
runwithhot:And that's it!
icedintegrates internally withsubsecond, so your code does not need to change at all.Simply edit your code and see it reload live!
Limitations
StateorMessagetypes will need a cold restart (for now!).Closes #21.