Skip to main content

validate_values

Function validate_values 

Source
pub fn validate_values<'d>(
    values: &OptionValues,
    site: BindSite,
    lookup: impl Fn(&OptionKey) -> Option<&'d OptionDecl>,
    roster: &[OptionKey],
    workflow: Option<&WorkflowName>,
) -> Vec<OptionError>
Expand description

Checks the option values values, set in the place site, against the option declarations: each value’s option type must be declared, with a binding that admits site.

lookup returns the declaration of an option type, or None when no feature declares it; roster lists every declared option type, which the error lists when a value is set for an undeclared type. workflow is the workflow whose render request sets the values, which the errors name; it is None for the document’s values and for a render request built by hand (PlanRequest::workflow). Returns every error found, in key order: an OptionError::UnknownOption or an OptionError::BindingRefused per value in question, and an empty list when every value is admitted.

The library calls this when a run is constructed (Run::new), for the values set on the document, and when a plan is built, for the values set on the render request; both report the first error only. The registry build calls it for the render option values of every workflow and reports every error.