pub trait Console {
// Required methods
fn say(&mut self, line: &str) -> Result<()>;
fn ask(&mut self, question: &str, default: Option<&str>) -> Result<String>;
fn ask_secret(&mut self, question: &str) -> Result<String>;
}Expand description
The terminal, or a scripted stand-in.
Required Methods§
Sourcefn ask(&mut self, question: &str, default: Option<&str>) -> Result<String>
fn ask(&mut self, question: &str, default: Option<&str>) -> Result<String>
Ask a question and read one line.
default is shown in the prompt and returned when the answer is empty,
so pressing Enter accepts it.
Sourcefn ask_secret(&mut self, question: &str) -> Result<String>
fn ask_secret(&mut self, question: &str) -> Result<String>
Ask for a secret and read one line without echoing it.
An empty answer is legitimate and means “skip”, so this cannot signal refusal by returning an error.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".