tilpner / includedir Goto Github PK
View Code? Open in Web Editor NEWInclude a whole directory tree at compile time
License: BSD 3-Clause "New" or "Revised" License
Include a whole directory tree at compile time
License: BSD 3-Clause "New" or "Revised" License
Before, it would check for the passthrough environment variable every run, but since
that's fixed now, the developer needs to force a rerun for passthrough to be re-evaluated.
Possible solution: Check PASSTHROUGH env var at startup, lookup paths in FS instead of in phf_map, remove passthrough codegen option
Been getting these attempt to calculate the remainder with a divisor of zero
errors from phf 0.7.24 in our project Tauri. According to the phf github this is a known issue that was resolved in 0.8. You can find associated issues here
Is there any way that you could update the library to 8.0 to help remove these problems?
I didn't use this with a large amount of files or deep file structures yet,
but while a phf map may be fast, it breaks down as soon as the included directories become deeper and more complex.
Would a filesystem-ish tree API be a better fit here?
One could imitate the std::fs
API without writability, to allow for proper path manipulation,
directory listing, tree walking, etc.
Opinions? @emk
If includedir_codegen
is used from build.rs
, it's strictly required to limit rebuilds to only cases of the files changed that are being included, so includedir_codegen
should emit cargo:rerun-if-changed=<path>
for each file includes.
cc @eddyb
Might be interesting to see whether using fst can be faster than phf and/or yield a smaller binary size. You'll probably have to build with the (compressed) contents first and then build the map using the sorted list of file paths and use (offset,len) tuples as values. Loading the map should be something like Map::from_static_slice(include_bytes!(concat!(env!("OUT_DIR"), "/index.fst")))
. I've done something like this in static-filez.
After updating phf to 0.8, only borrows can be used to construct the map.
It's unlikely to cause any problems, but it'll be unnecessary after rust-phf/rust-phf#185 is merged.
Hello.
To clean up main.rs
, I'd like to include the file resulting from the build script to another module (let's say src/assets.rs
).
Alas, the current generated file assumes it's included in the top-level module / main.rs
and at build time, trying to use something from includedir fails as it doesn't find the includedir crate (did you mean self::includedir...
).
Is it possible to add an option or eventually detect include!
in modules to make the generated file include self::
as a suffix and avoid this issue?
Thanks in advance and have a nice day.
Any interesting in accepting a PR that resolves symbolic links?
Upgraded from rust 1.28 to 1.30, and it stopped compiling:
include!(concat!(env!("OUT_DIR"), "/data.rs"));
error: couldn't read "src/routes/false/data.rs": No such file or directory (os error 2)
--> src/routes/statics.rs:11:1
|
11 | include!(concat!(env!("OUT_DIR"), "/data.rs"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.