pub trait QuestionnaireInput: Sized {
// Required method
fn questionnaire() -> Result<Questionnaire, QuestionnaireError>;
// Provided methods
fn from_raw_answers(
raw: &RawAnswers,
) -> Result<Self, QuestionnaireInputError> { ... }
fn from_raw_answers_with<F>(
raw: &RawAnswers,
form: F,
) -> Result<Self, QuestionnaireInputError>
where F: FnOnce(&Self) -> Vec<FormError> { ... }
}Expand description
A derived questionnaire definition and typed filler.
Implemented by standout-macros for structs that derive
Questionnaire. The generated implementation has two pieces:
questionnaire, which constructs the runtime definition throughQuestionnaire::newso all existing construction invariants remain load-bearing.from_decoded_answers, which directly materializes the struct from successfully decodedAnswerswithout involving serde or stringly application conversion code.from_raw_answers_with, which lets an application add whole-form rules over the filled struct while keeping field decoding, defaults, conditions, and validators on the shared runtime path.
The derive also emits hidden helpers used to lower and fill nested
questionnaire structs. They keep nested fields on the same stable
group-prefix and occurrence-path model as the public runtime definition.
An active_when controller must name a field of the same derived struct;
the macro resolves it to the field’s stable definition ID at expansion
time.
Required Methods§
Sourcefn questionnaire() -> Result<Questionnaire, QuestionnaireError>
fn questionnaire() -> Result<Questionnaire, QuestionnaireError>
Construct the runtime questionnaire definition for this type.
Construction errors are the normal QuestionnaireError values from
the public builder and identify the invalid questionnaire or field ID.
Provided Methods§
Sourcefn from_raw_answers(raw: &RawAnswers) -> Result<Self, QuestionnaireInputError>
fn from_raw_answers(raw: &RawAnswers) -> Result<Self, QuestionnaireInputError>
Decode raw answers with this type’s generated definition and return the filled struct.
Definition construction runs through the public builder, then the normal shared decode pipeline validates fields, defaults, optionality, conditions, and validators before the generated filler constructs the struct.
Sourcefn from_raw_answers_with<F>(
raw: &RawAnswers,
form: F,
) -> Result<Self, QuestionnaireInputError>
fn from_raw_answers_with<F>( raw: &RawAnswers, form: F, ) -> Result<Self, QuestionnaireInputError>
Decode raw answers, fill the struct, then run typed whole-form rules.
Use this when a questionnaire has constraints that span fields after
the field-level stage has already produced typed values. The form
closure receives the filled struct and returns FormError values
that are reported as normal validation diagnostics. The form closure
does not run when field decoding fails.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".