Skip to main content

questions

Macro questions 

Source
questions!() { /* proc-macro */ }
Expand description

Makes a question set with a name for each question set in it.

Its answers are a struct with the same field names. A field with only a name is short for the variable of that name, as in a struct literal. Each field must be a question set, and an error at the field tells the fix for each other value. A tag takes other data along. The struct of the answers derives Debug, Clone, and Serialize when the types of its fields do. questions! {} sends no request.

The set has no type name, so it cannot be a constant. A named set can: see Answers.

§Examples

use system2::prelude::*;

let triage = questions! {
    urgent: noul!("Is the ticket urgent?"),
    angry: noul!("Is the customer angry?"),
}
.ask("The site is down again.")
.await?;
if triage.urgent.is_likely() && triage.angry.is_likely() { /* … */ }