1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
//! 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. //! //! ```rust,no_run //! 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. //! //! ```rust,ignore //! include!(concat!(env!("OUT_DIR"), "/assets.rs")); //! ``` #![deny(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, unused_import_braces, unused_qualifications)] #[macro_use] extern crate error_chain; #[cfg(test)] extern crate tempfile; #[cfg(test)] extern crate tempdir; mod files; mod dirs; mod serializer; mod frontend; pub use frontend::{include_dir, IncludeDirBuilder}; /// Submodule containing code generated by `error-chain`. pub mod errors { error_chain!{ foreign_links { IO(::std::io::Error) #[doc = "A wrapper around a std::io::Error"]; } } }