Expand description
Compile-time-validating resource embedding proc macro for Teksilo.
Provides res! which embeds a file into the binary, validates its
format at compile time, and returns a lazily-decoded &'static reference.
§Supported formats
| Extension | Validation | Runtime type |
|---|---|---|
.svg | Parsed with the real SvgIcon parser: it must parse and carry drawable geometry (see validate_svg) | &'static SvgIcon |
.png | Magic bytes + IHDR chunk | &'static RasterIcon |
.webp | RIFF + WEBP signature | &'static RasterIcon (static) or &'static AnimatedIcon (animated) |
§Usage
ⓘ
use teksilo_resources::res;
// In a function — returns &'static decoded type:
let icon = res!("resources/icons/save.svg");
let logo = res!("resources/icons/logo.png");
// As a static (alternative form):
res!(pub SAVE_ICON = "resources/icons/save.svg");Paths are relative to CARGO_MANIFEST_DIR. By convention, resources
live under resources/.
Macros§
- res
- Embed a resource file with compile-time format validation.