Struct termimad::Question[][src]

pub struct Question {
    pub md: Option<String>,
    pub answers: Vec<Answer>,
    pub default_answer: Option<String>,
}
Expand description

a question that can be asked to the user, requiring him to type the key of the desired answer

A question can be built using Question::new or with the ask! macro

Fields

md: Option<String>answers: Vec<Answer>default_answer: Option<String>

Implementations

Create a new question with some text.

add a proposed answer, with a key

The user will have to type the result of calling to_string() on the key (numbers, chars, or strings are naturally good options for keys)

set the value which will be returned if the user only hits enter.

It does not have to be one of the answers’ key, except when you use the ask! macro.

has a default been defined which isn’t among the list of answers?

Does the asking and returns the inputted string, unless the user just typed enter and there was a default value.

If the user types something not recognized, he’s asking to try again.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.