Crate print_typewriter

Source
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 CharDurations containing the arguments.
print_typed
Prints a formatted string using the provided CharDurations Uses Writer::print_typed to print to the standard output one character at a time, without newline.
println_typed
Prints a formatted string using the provided CharDurations Uses Writer::print_typed to print to the standard output one character at a time, with a newline.

Structs§

CharDurations
A CharDurations type to represent how long Writer::print_typed should take to print out the inputted String
Writer
A Writer to print out given strings one letter at a time using the provided CharDurations