macro_rules! embed {
() => { ... };
}Expand description
Pull in the assets generated by tower-serve-embedded-build.
Call this once at module scope (typically at the crate root in main.rs or lib.rs). It
expands to an include! of the build script’s generated file, bringing into scope:
pub static ASSETS: tower_serve_embedded::Assets— the embedded asset set, andasset!— a crate-local compile-time macro mapping a crate-root-relative path to its URL.
The generated asset! macro is deliberately not emitted with #[macro_export], because Rust
treats macro_export macros generated by another macro as future-incompatible when they are
referenced by absolute paths. If you invoke embed!() at the crate root, you can use
crate::asset!(...) from other modules.
ⓘ
tower_serve_embedded::embed!();
fn css() -> &'static str { crate::asset!("assets/css/style.css") } // "/assets/css/style.9f3a1c2b.css"