6 releases
0.2.3 | Apr 25, 2023 |
---|---|
0.2.2 | Apr 25, 2023 |
0.1.2 | Apr 24, 2023 |
#798 in Procedural macros
65 downloads per month
5KB
55 lines
Asset Procmac
Some i/o macros that help with applications that need assets, by importing them using normal FS in debug builds, but directly embedding the data in the application in release builds.
Installation
cargo add asset_procmac
or
[dependencies]
asset_procmac = "[CURRENT VERSION]"
Quick start
use asset_procmac::include_if_release;
use std::fs;
// In file a.txt:
//
// hi mom
fn main() {
fs::remove_file("a.txt");
std::thread::sleep(std::Duration::from_secs(3));
prinln!("{}", include_if_release!("a.txt")); // Panics in debug builds, but prints the contents of a.txt in release builds.
//This is because the file is built into the executable in release builds, but simply read during runtime in debug builds.
//This is handy because it removes the need to recompile every time an asset changes.
}
Whats new
v0.2.1, v0.2.2+
- Fixed important bug in v0.2.0, version yanked
- Better Documentation
- Minor improvements
lib.rs
:
Some i/o macros that help with applications that need assets, by importing them using normal FS in debug builds, but directly embedding the data in the application in release builds.
Dependencies
~245–700KB
~17K SLoC