Rust Asset System
Rasset is a library that provides proc macros to serialize Rust structs into a binary file at build time and deserialize at runtime.
Quick start
Please take a look at examples and the template.
asset_def!
assets!;
Documentation
Asset definiton
Proc macro asset_def creates a struct for the asset type.
Asset declaration
Proc macro assets takes instances of a struct defined in asset_def and creates a compile_assets func.
Proc macro asset_file takes a YAML file and generates assets from there, similar to assets. Example:
- name: Player
type: Sprite
metadata:
size:
texture: "/path/to/player/texture/"
- name: Enemy
type: Sprite
metadata:
size:
texture: "/path/to/enemy/texture/"
YAML supports there tags:
!Rust: Instead of storing the string, parser with interpret the data as a Rust expression.texture: !Rust include_bytes!("texture.png").to_vec()!IncludeBytes: Generatesinclude_bytes!(STRING).!IncludeStr: Generatesinclude_str!(STRING).!IncludeVec: Generatesinclude_bytes!(STRING).to_vec().