How can I save a string and the CharIndices returned by calling the char_indices() method on this string in the same struct? I other words how do I make the following work?
You can't (without shenanigans) have a thing and a reference to that thing (which CharIndices contains) in the same struct: it would make the struct unmoveable because the pointers inside CharIndices would become invalid when moved.