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
//! Example showing off embedding of assets into the application binary.
//!
//! Embedding strategy can be used to produce truly standalone binary artifacts
//! that don't need to go to the filesystem for static files at runtime.
//!
//! # Rebuilding on assets change
//!
//! Note that, as this is just an example that doesn't come with a build
//! script, you will be required to forcibly clean the artifact and rebuild
//! after you introduce changes to `examples/assets`.
//!
//! In a real project it's useful to establish a `build.rs` that prints the
//! following:
//!
//! ```rust
//! println!("cargo:rerun-if-changed=<PATH_TO_ASSETS>")
//! ```
//!
//! This will ensure rebuild on changes made to the directory to be embedded.
use ;
use ServeDir;
use Config;
// embed files from `examples/assets` directory into the binary
static ASSETS: = include_dir!;
async