Skip to main content

parse_single_string_enum_selection

Function parse_single_string_enum_selection 

Source
pub fn parse_single_string_enum_selection<T>(
    value: &str,
    key: &str,
    allowed_values: &str,
    parse: impl Fn(&str) -> Option<T>,
) -> Result<T>
Expand description

Parses a single string enum value with legacy single-item array compatibility.

New string_enum config values should be stored as scalar strings. Some older Aster deployments stored single-select values as a JSON array with exactly one string because the UI previously treated them like enum sets. This helper keeps that migration-compatible shape in one place while product crates still own the concrete enum and accepted values.