I'm using the x509-parser crate which derives from nom. Knowing that is useful for context but the question is really a larger Rust lifetime question.
I want to be able to build up a list of parsed structs, in this case a
Vec<X509Certificate> for which I can manage the lifetime of that list as a whole. An
X509Certificate is actually
X509Certificate<'a> where the lifetime must match the
&'a [u8] source material.
I haven't found a way to manage the life of the source material and the parsed
X509Certificate struct jointly.
I'm totally willing to clone the source material before parsing; the overhead is acceptable in this particular use case, but I can't find a way to package the two in such a way that makes the borrow checker happy.
Is there a secret sauce that I'm missing? Or is this impossible?