2025-07-28 19:35:48 +02:00
2025-07-28 19:35:48 +02:00
2025-07-28 19:57:25 +02:00
2025-07-28 19:35:48 +02:00
2025-07-28 19:49:34 +02:00
2025-07-28 19:49:34 +02:00
2025-07-28 19:57:25 +02:00

Simple way to use include_bytes! for directories.

Example

use dir_embed::Embed;

#[derive(Embed)]
#[dir = "../web/static"] // Path is relativ to the current file
pub struct Assets;

fn main(){
    let file: &[u8] = Assets::get("css/style.css").expect("Can't find file");

    let string = str::from_utf8(file).expect("Failed to parse file");

    println!("{string}");
}
Description
Like include_bytes! for directories
https://crates.io/crates/dir-embed/
Readme 81 KiB
Languages
Rust 100%