Crates.io | asset_procmac |
lib.rs | asset_procmac |
version | 0.2.3 |
source | src |
created_at | 2023-04-24 07:17:17.919059 |
updated_at | 2023-04-25 13:00:08.142188 |
description | 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. |
homepage | |
repository | |
max_upload_size | |
id | 847127 |
size | 6,035 |
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.
cargo add asset_procmac
or
[dependencies]
asset_procmac = "[CURRENT VERSION]"
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.
}