ascii_linker
Embed ASCII art animations generated by asciic directly into your Rust binary at compile time.
Overview
This crate provides two procedural macros for working with .bapple files:
link_frames!- Embeds decompressed ASCII frames as strings (zero runtime overhead)embed_full!- Embeds compressed frames with audio data and timing metadata (smaller binaries)
Usage
Simple Animation (link_frames!)
use link_frames;
const FRAMES: & = link_frames!;
Full Animation with Audio (embed_full!)
Add zstd to your dependencies:
[]
= "..."
= "0.13"
use embed_full;
const BAPPLE: = embed_full!;
What's a .bapple?
A tar archive containing:
- Zstd-compressed ASCII art frames
- Audio data (optional)
- Timing metadata in RON format
These files are automatically generated by asciic.
Why?
link_frames! benefits:
- Zero runtime overhead - All frames decompressed at compile time
- Instant frame access - No decompression needed
- Single binary distribution - No external files required
- No file I/O needed - Perfect for embedded systems
- Works in bare-metal environments - Kernels, bootloaders, etc.
embed_full! benefits:
- Smaller binary size - Frames stay compressed
- Includes audio - Audio data embedded alongside frames
- Timing metadata - Automatic framerate/timing information
- More flexible - Control decompression at runtime
Trade-offs
| Feature | link_frames! |
embed_full! |
|---|---|---|
| Binary size | Large (decompressed) | Small (compressed) |
| Runtime overhead | None | Decompression per frame |
| Dependencies | None | Requires zstd |
| Audio support | No | Yes |
| Timing metadata | No | Yes |
| Best for | Small animations, embedded systems | Larger animations, desktop apps |
License
MIT