hot-lib-reloader-rs
hot-lib-reloader-rs copied to clipboard
Including functions from multiple files is a bit tedious
The hot_functions_from_file!
macro is very helpful, but it only works on single files (which most non-trivial projects grow out of quite quickly). If a user wants to break up their project into multiple files for manageability, their options are:
- Redefine the hot-reloaded library's whole API either in a single file for
hot_functions_from_file!
to pick up or directly in thehot_module
- Multiple calls to
hot_functions_from_file!
for every file in the project
Both of these things are rather clumsy and would be unnecessary if hot_functions_from_file!
didn't only work on single files. I took a look at the package source to see if there's any technical limitation preventing the macro from working on folders too but as far as I can tell, the only thing is that if a user uses the ignore_no_mangle
option there is the possibility of duplicate function names in different files.
Proposal
Provide a new hot_functions_from_folder!
or hot_functions_from_crate!
macro that recursively pulls public no-mangled function definitions from a provided folder or crate path. Unlike hot_functions_from_file!
it will not take an ignore_no_mangle
argument, so that the function names/symbols are known to be unique.
I don't mind implementing it myself if you're good with this but that would have to be over the weekend.