rust-embed 6.8.1

Rust Custom Derive Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use rust_embed::RustEmbed;

#[derive(RustEmbed)]
#[folder = "examples/public/"]
struct Assets;

/// Prevent attempts to access files outside of the embedded folder.
/// This is mainly a concern when running in debug mode, since that loads from
/// the file system at runtime.
#[test]
fn path_traversal_attack_fails() {
  assert!(Assets::get("../basic.rs").is_none());
}