defaults/defaults.rs
1extern crate question;
2use question::{Answer, Question};
3
4fn main() {
5 let question = "What is the answer to the Ultimate Question of Life, \
6 the Universe, and Everything?";
7
8 let default = Answer::RESPONSE(String::from("42"));
9 let answer = Question::new(question)
10 .default(default.clone())
11 .show_defaults()
12 .ask()
13 .unwrap();
14 let correct = default;
15 assert_eq!(answer, correct);
16}