pause_for_time

Macro pause_for_time 

Source
macro_rules! pause_for_time {
    ($seconds:expr) => { ... };
    ($seconds:expr, $message:expr) => { ... };
}
Expand description

Macro: pause_for_time!

Pauses the program execution for a specified number of seconds and displays a countdown. During the pause, the remaining time is updated on the same console line.

§Usage

  • pause_for_time!(seconds); - Displays a countdown with the default message.
  • pause_for_time!(seconds, "Custom message {}s"); - Displays a countdown with a custom message.

§Arguments

  • $seconds: The total number of seconds to wait.
  • Optional: $message: A custom message to display with a placeholder for the countdown.

§Environment Variables

The behavior can be influenced by the SYSTEM_PAUSE environment variable:

  • CLEAR_TIMER_LINE=true: Clears the countdown line after completion.

§Example

pause_for_time!(5); // Pauses for 5 seconds with a default message.
pause_for_time!(5, "Custom pause for {} seconds"); // Custom message.