[−][src]Crate resource
This crate contains macros for statically including resources in release mode, but dynamically loading them in debug mode.
This is primarily intended for games, allowing you to both avoid file IO in release builds and dynamically reload resources in debug mode.
You can change the default behaviour, in debug or release mode, by using the
force-static
and force-dynamic
features.
ⓘThis example is not tested
use resource::{resource, resource_str}; // Include text let readme_text = resource_str!("README.md"); // Include bytes let logo_bytes = resource!("assets/logo.png"); // Load multiple strings let translations = resource_str!(["english.txt", "italiano.txt"]); // Load and process multiple binary resources let (light_texture, dark_texture) = resource!( ("assets/light.png", "assets/dark.png"), Texture::decode);
Macros
resource | Load binary resources statically in release mode, or dynamically in debug. |
resource_str | Load text resources statically in release mode, or dynamically in debug. |
Structs
Resource | A resource (string or binary) loaded in memory. |
Traits
ReadFromFile | Used internally. |