Skip to main content

DecisionAnswers

Trait DecisionAnswers 

Source
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§

Source

fn questions() -> BTreeMap<String, DecisionQuestion>

The questions, keyed by field name.

Source

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".

Implementors§