Crates.io | load_file |
lib.rs | load_file |
version | 1.0.1 |
source | src |
created_at | 2018-08-09 09:30:49.243942 |
updated_at | 2021-07-30 17:18:20.490113 |
description | Macros to help conveniently load the contents of files during development. |
homepage | |
repository | https://github.com/maghoff/load_file |
max_upload_size | |
id | 78482 |
size | 10,047 |
This crate provides macros to help conveniently load the contents of files during development.
load_str!
and load_bytes!
are modeled after include_str!
and
include_bytes!
from the standard library. The standard library macros
are useful in many situations, one of which is quick-and-dirty loading of
assets during a prototyping phase. (Examples of such assets are static web
assets such as CSS or GLSL shaders for a game.) The load_*
macros aim to
offer a convenient way of loading the assets dynamically at run-time
instead. This gets rid of the need to compile or even restart for every
change while iterating on the assets.
Before:
fn main() {
println!("{}", include_str!("greeting.txt"));
}
After:
#[macro_use]
extern crate load_file;
fn main() {
println!("{}", load_str!("greeting.txt"));
}