asset_procmac

Crates.ioasset_procmac
lib.rsasset_procmac
version0.2.3
sourcesrc
created_at2023-04-24 07:17:17.919059
updated_at2023-04-25 13:00:08.142188
descriptionSome 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
id847127
size6,035
mizu (WhyNotDogie)

documentation

README

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
Commit count: 0

cargo fmt