Crates.io | glace |
lib.rs | glace |
version | 0.1.0 |
source | src |
created_at | 2022-10-20 21:32:22.686405 |
updated_at | 2022-10-20 21:32:22.686405 |
description | A type-safe, user-friendly proc macro for embedding a file tree into your code. |
homepage | https://github.com/mistodon/glace |
repository | https://github.com/mistodon/glace |
max_upload_size | |
id | 692982 |
size | 44,947 |
(Like the cherries.)
A proc macro for embedding an entire directory tree into your Rust code in a type-safe, human-friendly, flexible way.
At its simplest, it provides you with an enum variant matching every file in the tree, so you know at compile-time that the paths to your assets exist. At its most powerful, it can load all of those files into const memory, generate serde
structs to represent them, provide methods for loading and deserializing (and transparently cacheing) them.
The ideal future of this crate is to fully abstract away the notion of files and allow you to write code as though all of your assets are hard-coded (without, of course, having to hard-code them). We're not there yet, but what's implemented already is useful in its own right.
See docs.rs/glace (and in particular the docs_only_example_assets module) to get some idea of what glace
generates for you.
See also the testcrate
crate in this repo for some examples of how to use the results.