#terminal #tty #console #animation

ttycarousel

Console animations for Rust

5 releases

0.1.4 Apr 21, 2022
0.1.3 Apr 21, 2022
0.1.2 Apr 21, 2022
0.1.1 Apr 21, 2022
0.1.0 Apr 21, 2022

#522 in Command-line interface

Download history 1/week @ 2023-11-04 3/week @ 2023-11-11 6/week @ 2023-11-18 13/week @ 2023-11-25 7/week @ 2023-12-02 1/week @ 2023-12-09 5/week @ 2023-12-16 13/week @ 2023-12-23 1/week @ 2023-12-30 5/week @ 2024-01-06 1/week @ 2024-01-13 7/week @ 2024-01-20 11/week @ 2024-01-27 17/week @ 2024-02-10 87/week @ 2024-02-17

115 downloads per month

Apache-2.0

2MB
265 lines

ttycarousel - Console animations for Rust

This crate provides a simple carousel animation for console, to ensure your users do not get bored and do not think that the program is dead.

Crate: https://crates.io/crates/ttycarousel

Sync programs

Add to Cargo.toml:

[dependencies]
ttycarousel = { version = "*", features = ["sync"] }

Simple

use std::time::Duration;

ttycarousel::spawn0("working");
std::thread::sleep(Duration::from_secs(2));
ttycarousel::stop();
println!("work completed!");

With options

use std::time::Duration;

ttycarousel::spawn(
    "working",
    ttycarousel::Options::new()
        .speed(50)
        .color(ttycarousel::Color::Yellow)
        .bold(),
);
std::thread::sleep(Duration::from_secs(2));
ttycarousel::stop();

Async (Tokio)

Add to Cargo.toml:

[dependencies]
ttycarousel = { version = "*", features = ["tokio1"] }

Async example:

use std::time::Duration;

async fn task1() {
    ttycarousel::tokio1::spawn(
        "working",
        ttycarousel::Options::new()
            .speed(50)
            .color(ttycarousel::Color::Yellow)
            .bold(),
    ).await;
    //ttycarousel::tokio1::spawn0("working").await; // with defaults
    tokio::time::sleep(Duration::from_secs(2)).await;
    ttycarousel::tokio1::stop().await;
    println!("work completed!");
}

P.S.

Yep, I had nothing to do.

Dependencies