Is there some way of writing complex data structures as constants? If not, is this under consideration somewhere (e.g. as part of CTFE)?
I want an array of arrays, however since the length of the internal arrays is not fixed, some kind of abstraction is necessary. This is the best I came up with, though it seems usage of Box
isn’t allowed in constants:
/// For each objective (in order), a list of associated scenario numbers:
const OBJECTIVE_SCENARIOS: [Box<[u32]>; NUM_OBJECTIVES as usize] = [
box [30], // PREVALENCE_AFTER_INTERVENTION
box [24, 28, 29, 31, 35, 34], // PREVALENCE_AGEPATTERN
box [24,28,29,31,35,34], // PARASITE_DENSITIES_AGEPATTERN
box [34], // MOI_AGEPATTERN
box [232,233], // CLINICAL_INCI_AGEPATTERN_A
box [49], // CLINICAL_INCI_AGEPATTERN_B
box [234], // THRESHOLD_CLINICAL_ATTACK
box [501,502,503,504,505,506,507,508,509,510,511,512,514,515,516,517,518,
519, 520,521,522,523,524,525,526,527], // SEVERE_PRE_PATTERN
box [158,167,173,176], // SEVERE_AGEPATTERN
box [301,302,303,312,316,317,318,326,327], // MALARIA_MORATALITY
box [401,402,408,411,414,415,416,417,418,422,426] // ALL_CAUSE_MORTALITY
];