Rattles Terminal Spinners
Skill by ara.so — Daily 2026 Skills collection.
Rattles is a minimal, zero-dependency Rust library for terminal spinners. It has no runtime or lifecycle — spinners are constructed directly in render loops with negligible cost. Supports no_std environments.
Installation
Or via CLI:
Core Concepts
- Rattler: a spinner definition (frames + interval). Stateless and cheap to construct.
- TickedRattler: stateful wrapper for tick-based driving (required in
no_std). - Presets: built-in spinners organized by category.
rattle!macro: define custom spinners at compile time.
Basic Usage (std)
current_frame() uses the system clock internally — no state needed.
Preset Categories
Rattler API
TickedRattler (Stateful / no_std-friendly)
TickedRattler must be stored (it holds state). Suitable for no_std contexts where the global clock is unavailable.
Index-Based Animation (no_std)
Time-Based Animation with External Clock (no_std)
Custom Spinners with rattle! Macro
Multi-row custom spinner:
Ratatui Integration
Since Rattler is stateless, pass it by reference anywhere — no Arc<Mutex<>> needed.
no_std Setup
Common Patterns
Spinner with message
Async-compatible (tokio)
Collecting all frames
Troubleshooting
Spinner not animating (stuck on first frame)
- Ensure you're flushing stdout:
std::io::stdout().flush().unwrap() - Use
\rto overwrite the line, not\n - The sleep interval should match or be shorter than the spinner's interval
current_frame() not available in no_std
- Use
frame_at(duration),frame(index), orinto_ticked()instead - Disable default features:
rattles = { version = "...", default-features = false }
Custom spinner not compiling
- Keyframes must be string literals in the
rattle!macro array - Row count must match the visual width of each keyframe string
Spinner looks garbled in terminal
- Some braille/emoji frames require a terminal with Unicode support
- Test with ASCII presets (
ascii::line()) to verify basic functionality first


