Do I need generic_associated_types?

#1

While working on my crate double-ratchet, I got some feedback that I should provide an interface for inplace encryption. I could implement that directly, but I realized that from an API perspective, all my code is doing is passing along the input from DoubleRatchet::ratchet_encrypt to CryptoProvider::encrypt and pass along its output the other way (similar for the decrypt function). So I think that any restriction I put upon the types of these values is too restrictive and instead I should provide a generic API that works for any type.

Concretely, I tried to build something: (see playground), but I can’t get the lifetimes correct to make it compile. I tried to remove everything non-essential and added three examples of reasonable instantiations with a test for basic functionality. The playground code should make clear what I intend to do…

How do I fix this, or is this approach just not the right way?