Here is the basic problem. Let's say I have a group of vectors with
u8 values. They would look like this:
let vec1 = vec![0,0,2,2,4,4]; let vec2 = vec![1,1,0,0,0,0]; let vec3 = vec![0,0,0,0,3,3];
Then let's say I have a second, smaller Vec that represents a "null" slice, such that I want to find the first matching slice of the collection and return that. In this example, the null slice would be:
let null_slice = vec![0,0];
Finally, the result I want is a single vector that matches
That is, jumping by two (the length of the null slice) and going last to first, I want to return the first slice that doesn't match null. So slice one is 1,1, then slice two is 2, 2, then slice 3 is 3,3, then I put them all into a single vector. Note that it should not use 4,4 in the last block as 3,3 would be found first and therefore it will stop searching.
EDIT: One more note is that this would be an unknown number of vectors to merge. Anything from 1 to 20 vectors in most use cases.