Crate include_dir [−] [src]
The logical evolution of the include_str!()
macro to allow embedding
entire file trees.
If you want to use this in stable, you'll need a build.rs
build script.
extern crate include_dir; use std::env; use std::path::Path; use include_dir::include_dir; fn main() { let outdir = env::var("OUT_DIR").unwrap(); let dest_path = Path::new(&outdir).join("assets.rs"); include_dir("assets") .as_variable("SRC") .to_file(dest_path) .unwrap(); }
Then in one of your source files, you'll need to include the generated
assets.rs
file.
include!(concat!(env!("OUT_DIR"), "/assets.rs"));
Modules
errors |
Submodule containing code generated by |
Structs
IncludeDirBuilder |
A builder object to give the |
Functions
include_dir |
The entire purpose of this crate. |