Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Embed Files Into A Rust Binary

Code

```cargo
[dependencies]
rust-embed = "8.3"
```

use rust_embed::RustEmbed;

#[derive(RustEmbed)]
#[folder = "recursive_test"]
struct Asset;


fn main() {
  for file in Asset::iter() {
      println!("{}", file.as_ref());
  }
}

Results

.DS_Store
example/.DS_Store
example/.hidden_file_1.txt
example/.hidden_file_2.txt
example/1.txt
example/a/.DS_Store
example/a/2.txt
example/a/c/4.txt
example/a/c/delta.html
example/alfa.html
example/b/3.txt
example/b/charlie.html
example/bravo.html

References