Expand description
This crate provides a simple way to print a string and have each letter take a duration of time to be printed out.
§Examples
Typing out “hello” with each character taking 10 milliseconds to be printed
use print_typewriter::{char_duration, println_typed};
let duration = char_duration!(default 10.ms);
println_typed!(duration, "hello");Typing “hello world” with each word being typed instantly and each space taking 250 milliesconds
use print_typewriter::{char_duration, println_typed};
let duration = char_duration!(' '->250.ms);
println_typed!(duration, "hello world");Typing a formatted string, “hello {} world” with spaces taking 250 milliseconds, periods taking 1 second, and everything else taking 90
use print_typewriter::{char_duration, println_typed};
let duration = char_duration!(default 90.ms, ' '->250.ms, '.'->1.s);
let beans = "beans";
println_typed!(duration, "hello {} world", beans);Macros§
- char_
duration - Creates a
CharDurationscontaining the arguments. - print_
typed - Prints a formatted string using the provided
CharDurationsUsesWriter::print_typedto print to the standard output one character at a time, without newline. - println_
typed - Prints a formatted string using the provided
CharDurationsUsesWriter::print_typedto print to the standard output one character at a time, with a newline.
Structs§
- Char
Durations - A
CharDurationstype to represent how longWriter::print_typedshould take to print out the inputtedString - Writer
- A
Writerto print out given strings one letter at a time using the providedCharDurations