rattles 0.1.0

A collection of terminal spinners
Documentation
# 🪇 Rattles

![Demo](./.github/assets/demo.gif)

**Rattles** is a terminal spinner library for Rust. It is equipped with extensive preset library and lets you define custom spinners at compile time.

**Rattles** is *minimal*; it makes no assumptions about how the output will be used, and just works with no prior configuration required.

**Rattles** is *lightweight*; it's dependency-free, built for compile-time construction with minimal overhead.

## Quick Start

```sh
cargo add rattles
```

### Minimal example

```rust
use std::{io::Write, time::Duration};
use rattles::presets::prelude as presets;

fn main() {
    let rattle = presets::waverows();

    // change default interval
    // let rattle = presets::waverows().set_interval(Duration::from_millis(100));

    // reverse direction
    // let rattle = presets::waverows().reverse();

    loop {
        print!("\r{}", rattle.current_row());
        std::io::stdout().flush().unwrap();
        std::thread::sleep(Duration::from_millis(20));
    }
}
```

The interval of the animation can be configured with `set_interval(...)` method, and the direction can be flipped with `reverse()`.

### Custom keyframes

```rust
rattle!(
    Custom, // struct name
    custom, // method name
    1,      // number of rows (string width)
    100,    // interval in milliseconds
    ["⣾", "⣷", "⣯", "⣟", "⣻", "⣽", "⣾"] // keyframes
)
```

## Presets

Built-in presets are organized by category:

- `presets::arrows`
- `presets::ascii`
- `presets::braille`
- `presets::emoji`

A prelude is available `rattles::presets::prelude`.

## Examples

Example showcasing all presets, built with [ratatui](https://ratatui.rs/):

```bash
cargo run --example showcase
```

## Acknowledgements

- [sindresorhus/cli-spinners]https://github.com/sindresorhus/cli-spinners
- [gunnargray-dev/unicode-animations]https://github.com/gunnargray-dev/unicode-animations