Macro scanpw::scanpw

source ·
macro_rules! scanpw {
    () => { ... };
    ( $fmt:literal ) => { ... };
    ( $fmt:literal, $($args:tt)* ) => { ... };
    ( $echo:expr ) => { ... };
    ( $echo:expr, $fmt:literal ) => { ... };
    ( $echo:expr, $fmt:literal, $($args:tt)* ) => { ... };
}
Expand description

Reads a password from standard input

Invocations of scanpw expand to an expression retuning a String that contains a line of input from stdin. It can be invoked with arguments identical to those of print, and if so, those arguments will be used to generate a prompt on the standard output. Input will begin on the same line that the prompt ends, if any. If no arguments are provided, input will start where the cursor is, which is likely to be on its own empty line.

Panics

This macro will panic if there is an error writing the prompt or reading the password.