I'm working with data where essentially I get multiple inputs (files for which I use memmap to access) and I need to reconstruct/map the data from them into a single output file using specific logic.
I've tried using
&[u8] references to the input file data as my "pointers to appropriate data pieces" but that complicates the lifetimes so much it became unusable.
I switched to using things like
(usize, usize) pointers (or structs, doesn't matter) so that I can always point to the right input file/data location etc. but then it ends up having loads of
InputType::get_something(&self, index: usize) -> Whatever type of functions for every little thing.
I'm just wondering if there's any general good pattern to handle this without overcomplicating the lifetimes.
The real use case also requires abstraction which makes it even more complicated as the input and output types are generic/traited and the individual sections of data are specific to each backend.