Skip to main content

Crate teksilo_resources

Crate teksilo_resources 

Source
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

ExtensionValidationRuntime type
.svgParsed with the real SvgIcon parser: it must parse and carry drawable geometry (see validate_svg)&'static SvgIcon
.pngMagic bytes + IHDR chunk&'static RasterIcon
.webpRIFF + 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.