Registry / utility / rust-embed

rust-embed

JSON →
library8.11.0rscratesunverified

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

# Cargo.toml [dependencies] rust-embed = "8.11.0"
INSTALL
IMPORT
SIG · RUST-EMBED
R
rust-embed
utilityrustv8.11.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RustEmbed
use rust_embed::RustEmbed;

Embed files from a folder into the binary at compile time.

use rust_embed::RustEmbed; #[derive(RustEmbed)] #[folder = "examples/"] struct Asset; fn main() { let file = Asset::get("hello.txt").unwrap(); println!("{:?}", std::str::from_utf8(&file.data)); }
Debug
Known issues
gotchaFiles are loaded from the filesystem in debug mode, not embedded.
fix
Use `--release` to embed files into the binary.
affects: >=8.0.0
Upgrade
Version history
8.11.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
rust-embed — cargo add rust-embed · libregistry