On 10/23/25 1:44 PM, Dominik Csapak wrote: > On 10/23/25 1:19 PM, Shannon Sterz wrote: >> On Thu Oct 23, 2025 at 10:28 AM CEST, Dominik Csapak wrote: > [snip] >>> + >>> +struct ViewComp { >>> +    template: LoadResult, >>> + >>> +    // various api call results >>> +    status: LoadResult, >>> +    top_entities: LoadResult, >>> +    statistics: LoadResult, >> >> this is fine, but i just had an idea, maybe this isn't too useful right >> now, but might be worth exploring: we could turn this into a HashMap >> with something like this: >> >> HashMap> >> >> then loading could become iterating over the keys and calling a function >> on them. with a wrapper type we could even implement a getter that >> transforms the ApiResponseData to a concrete type. might cut down on the >> loading logic below and make this more easily extensible in the future. >> >> the required_api_calls below could then just return such a hashmap with >> only the necessary keys. what do you think (note i haven't tested any of >> this)? > > i don't think this will work, since ApiResponseData itself takes a > generic parameter too, and we can't use different ones for different > values of the same hashmap AFAIK > > but yeah, we should think about how we could generalize this > instead of just adding on new members... > sorry seems I dropped the list in my last response... so sending this again. thought about this a bit. we can leverage DeserializeOwned and Value here quite a bit to make it work. i did a bit of messing around and came up with the attached patch. this certainly isn't perfect or polished (e.g. we could use wrapper types to move the get_entities function somewhere more sensible; safe a clone here or there etc.), but the general gist is there. it also works so yeah :)