pub enum Answer {
    String(String),
    ListItem(ListItem),
    ExpandItem(ExpandItem),
    Int(i64),
    Float(f64),
    Bool(bool),
    ListItems(Vec<ListItem>),
}
Expand description

The different answer types that can be returned by the Questions

Variants

String(String)

Strings will be returned by input, password and editor.

ListItem(ListItem)

ListItems will be returned by select and raw_select.

ExpandItem(ExpandItem)

ExpandItems will be returned by expand.

Int(i64)

Ints will be returned by int.

Float(f64)

Floats will be returned by float.

Bool(bool)

Bools will be returned by confirm.

ListItems(Vec<ListItem>)

ListItems will be returned by multi_select and order_select.

Implementations

Returns true if the answer is Answer::String.

Returns Some if it is a Answer::String, otherwise returns None.

Returns the Ok(String) if it is one, otherwise returns itself as an Err.

Returns true if the answer is Answer::ListItem.

Returns Some if it is a Answer::ListItem, otherwise returns None.

Returns the Ok(ListItem) if it is one, otherwise returns itself as an Err.

Returns true if the answer is Answer::ExpandItem.

Returns Some if it is Answer::ExpandItem, otherwise returns None.

Returns the Ok(ExpandItem) if it is one, otherwise returns itself as an Err.

Returns true if the answer is Answer::Int.

Returns Some if it is Answer::Int, otherwise returns None.

Returns the Ok(i64) if it is one, otherwise returns itself as an Err.

Returns true if the answer is Answer::Float.

Returns Some if it is Answer::Float, otherwise returns None.

Returns the Ok(f64) if it is one, otherwise returns itself as an Err.

Returns true if the answer is Answer::Bool.

Returns Some if it is Answer::Bool, otherwise returns None.

Returns the Ok(bool) if it is one, otherwise returns itself as an Err.

Returns true if the answer is Answer::ListItems.

Returns Some if it is Answer::ListItems, otherwise returns None.

Returns the Ok(Vec<ListItem>) if it is one, otherwise returns itself as an Err.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. 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.