Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including functions from multiple files is a bit tedious #24

Open
filleduchaos opened this issue Nov 28, 2022 · 0 comments
Open

Including functions from multiple files is a bit tedious #24

filleduchaos opened this issue Nov 28, 2022 · 0 comments

Comments

@filleduchaos
Copy link

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 the hot_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.

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

No branches or pull requests

1 participant