v6.0.0
conradkleinespel
released this
13 Mar 17:46
·
24 commits
to master
since this release
This release contains breaking changes.
Notable changes:
- API changes to be more flexible and more generic;
- move to Rust 2018 edition;
- WASM/WASI support, thanks @john-sharratt.
The API has changed from:
pub fn read_password() -> Result<String>
pub fn read_password_from_tty(prompt: Option<&str>) -> ::std::io::Result<String>
pub fn read_password_with_reader<T: BufRead>(source: Option<&mut T>) -> Result<String>
pub fn prompt_password_stdout(prompt: &str) -> std::io::Result<String>
pub fn prompt_password_stderr(prompt: &str) -> std::io::Result<String>
To:
pub fn read_password_from_bufread(reader: &mut impl BufRead) -> std::io::Result<String>
pub fn read_password() -> std::io::Result<String>
pub fn prompt_password_from_bufread(reader: &mut impl BufRead, writer: &mut impl Write, prompt: impl ToString) -> std::io::Result<String>
pub fn prompt_password(prompt: impl ToString) -> std::io::Result<String>
By default, reading and writing is done from/to the TTY instead of stdin/stdout. This is more reliable for most cases. If you need to read or write from/to a different place, the function versions with from_bufread
allow you to pass anything you'd like.