🪇 Rattles

Rattles is a terminal spinner library for Rust with an extensive preset collection and lets you define custom spinners at compile time.
-
Rattles is compile-time first; all spinner data is baked in at compile time aiming for minimal overhead.
-
Rattles is minimal; it makes no assumptions about how the output will be used, and just works with no prior configuration required. It also has zero dependencies.
Philosophy
Most spinner libraries are built as actors or widgets. Rattles is neither. It has no runtime, no lifecycle, and requires no integration by default.
Spinners can be constructed directly in the render loop with negligible cost. The result is a library that gets out of your way.
Quick Start
Basic usage
use ;
use prelude as presets;
Custom keyframes
rattle!
no_std
rattles enables the std feature by default. To opt out:
Without std, the global clock is unavailable. Animations can still be driven three ways:
- Time-based, with an external clock:
rattle.frame_at - Index-based:
rattle.frame - Tick-based:
Note thatlet mut rattle = dots.into_ticked; rattle.tick; let frame = rattle.current_frame;TickedRattleris stateful and must be stored.
Presets
Built-in presets are organized by category:
presets::arrowspresets::asciipresets::braillepresets::emoji
A prelude is available rattles::presets::prelude.
Examples
Example showcasing all presets, built with ratatui:
There's also a minimal no_std-oriented usage example found here, including:
TickedRattlerusage viainto_ticked()- elapsed-time driven usage via
frame_at(...) - index-driven usage via
frame(...)