Closed zombiepigdragon closed 1 year ago
As a side note for future expansion; include_bytes!
itself won't work with compression, and some variation of the fallback path will have to be used. In that case, the automatic update on stable can be retained by inserting static _: &[u8] = include_bytes!(#path);
to the macro's output, which will force Cargo to watch the file for changes without actually storing an extra copy of it in the binary, at the cost of some build time.
I'd like to re-up that this pull request be merged or at least reviewed - it is solving the linked issue for me.
LGTM :+1:
Thanks for making this PR, @zombiepigdragon. Let's merge it!
This PR is the third introduction of
include_bytes!
, following #23 and #32. I suspect it being removed in 3e365328d4e506f17e698cfc25738f44d7e94106 wasn't intentional, as I can't find any justification for it in an issue/PR/commit. Like both preceding PRs, it uses the builtin compiler file inclusion mechanism for the files in an included directory, which reduces compiler memory usage, improves compiler performance, and allows changes to included files to rebuild the crate on stable. I did make the choice to keep the manual import based codepath available, as I suspect it would be useful in cases in which the path to the file contains invalid unicode (in which case, I don't believe Rust source code can express it), but I did not test this edge case.This still does not handle the addition of new files to the included directory on stable, only making it possible to rebuild by updating an existing file.
fixes #82