I have a
struct which is meant to store, with minimal memory overhead, some data.
This struct may be either generated at build time and compiled in, or generated at runtime and loaded into the program.
struct has a field that stores a list of tokens. I used generics to allow my tokens to be either
String in the
owned scenario or
&'static str in the const scenario, but I can't find a way to unify the struct to work with lists of tokens in both.
Here's a playground with two structs: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=fbc87945ed44135c78fc40a302025cfe
The list will never grow once created, and in both cases it's read only.
Is it possible to generalize it into a single one?