Crates.io | ttycarousel |
lib.rs | ttycarousel |
version | 0.1.4 |
source | src |
created_at | 2022-04-21 01:31:34.768219 |
updated_at | 2022-04-21 19:23:13.177277 |
description | Console animations for Rust |
homepage | |
repository | https://github.com/divi255/ttycarousel |
max_upload_size | |
id | 571286 |
size | 2,929,568 |
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
Add to Cargo.toml:
[dependencies]
ttycarousel = { version = "*", features = ["sync"] }
use std::time::Duration;
ttycarousel::spawn0("working");
std::thread::sleep(Duration::from_secs(2));
ttycarousel::stop();
println!("work completed!");
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();
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!");
}
Yep, I had nothing to do.