pub trait DecisionAnswers: Sized {
// Required methods
fn questions() -> BTreeMap<String, DecisionQuestion>;
fn from_output(output: &DecisionOutput) -> Result<Self, DecisionError>;
}Expand description
A struct whose fields are the questions of a decision step and whose values are the answers.
Derive it, see the module documentation.
§Examples
use ironflow_engine::decision::DecisionAnswers;
#[derive(DecisionAnswers)]
struct Review {
#[noul("Is the change safe to ship?")]
safe: f64,
}
assert!(Review::questions().contains_key("safe"));Required Methods§
Sourcefn questions() -> BTreeMap<String, DecisionQuestion>
fn questions() -> BTreeMap<String, DecisionQuestion>
The questions, keyed by field name.
Sourcefn from_output(output: &DecisionOutput) -> Result<Self, DecisionError>
fn from_output(output: &DecisionOutput) -> Result<Self, DecisionError>
Read the provider’s answers back into the struct.
§Errors
Returns DecisionError::NotFound when an answer is missing,
DecisionError::TypeMismatch when it is of another kind than its
question, and DecisionError::UnknownChoice when a choice is not one
of the options.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".