pub fn print_string_with_delay(word: &String, delay: Duration) -> Result<()>
Expand description
Helps you print String character by character
, using provided delay
ยงExamples
To print text with this effect do simply import and use it:
use std::time;
use shiny_cli_utils::print_string_with_delay;
let now = time::Instant::now(); // PoC
let your_text = String::from("Some string");
print_string_with_delay(&your_text, time::Duration::from_millis(20));
let how_long_it_should_actually_take =
time::Duration::from_millis(10 * your_text.chars().count() as u64); // PoC
assert!(now.elapsed() >= how_long_it_should_actually_take); // PoC