I am trying to call fn some_api_function() which takes &[T] as parameter. To generate that parameter for the function, I tried to call flat_map on a Vec of Vecs (which itself buried inside RefCell). But I have trouble convert Vec<&T> to &[T]. I'd preferably avoid Copy or Clone the entire dataset for performance reason, as some_api just need to read-only borrow the data.
Compiling playground v0.0.1 (/playground)
error[E0308]: mismatched types
27 | some_api(&env_vars);
| ^^^^^^^^^ expected slice, found struct `Vec`
= note: expected reference `&[EnvVar]`
found reference `&Vec<&EnvVar>`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `playground` due to previous error
In that case, you'd need to store your data in a different way such that all the env_vars are present in a single vector from the get-go.
One way would be move all the env_vars into the Arena and store indices in the child structs.