Code Monkey home page Code Monkey logo

Comments (6)

pyrossh avatar pyrossh commented on May 23, 2024

Hi @alerque
We don't have support for that yet. But something like reading from an file that lists all the files/folders that need to be included can be implemented I guess. But why don't you move all the required files/folders into a new folder and embed that. This would require a it of scripting I guess wouldn't this be the same a generating a file with the includes.

from rust-embed.

alerque avatar alerque commented on May 23, 2024

I thought I was being pretty tricky here, but just realized another design issue has me blocked.

I came up with a full file list to include. I auto generated this using the build system that had the data anyway, and used it to write out a file that is just a flat list of #[include = "..."] statements which a whitelist of what I want to include. That list I stuffed into the rust file setting up the embeds using a template system.

The trouble is, it seems a whitelist is useless. Exclude takes total priority, so the only way this is going to work is with a blacklist of every file in the file system I don't want to include, which is much more complicated.

I'm now in a catch 22. Copying files to an isolated location defeats a large chunk of the purpose of using this crate in the first place: being able to use filesystem data while working in the development tree and only having assets embeded in release builds.

Is there any way we can get some sort of prioritized globing worked out, perhaps more like .gitignore rules where includes and excludes can be combined to filter out most of the noise while including a specific list?

from rust-embed.

pyrossh avatar pyrossh commented on May 23, 2024

Yep you are right this library is mainly used to improve dx. Maybe if we move the priority of exclude below that of the include it might work. I agree something like .gitignore rules might be better. Or maybe a .embedignore file.
Another solution is add a glob pattern which supports regex like most cli's offer.

from rust-embed.

alerque avatar alerque commented on May 23, 2024

Lowering the priority of exclude= would certainly work for my use case. Honestly I'm more than a bit confused about what the include= is even supposed to do given that folder= already iterates over everything on the disk, so you basically start out with include=* and then work from there. Given that starting point I assorted uses of exclude= make sense, but what can include=... even do?

One other note is about performance: the current compile times don't seem to be related to how many files or how much data gets embeded, but they are very related to how big the file system in include= is, and it seems to be exponential. If you have a big file system it doesn't matter if you exclude=* or exclude all but a few files, the resulting compile times are quite slow.

from rust-embed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.