I thought I understood lifetimes
pub struct Waveform<'a, MutSlice, Img: 'a, B>
where
MutSlice: DerefMut<Target=[u8]> + 'a,
B: Fn(&'a mut Img) -> MutSlice,
{
I do not understand lifetimes
I'm trying to write something that abstracts away from the types used by a library by using generics. Problem is I have a type (Img) from which I would like to borrow some bytes (&mut [u8]) in a manner that does not require knowing what Img is (hence closure B). I can't borrow the bytes directly from Img in B though, I can only get an owned type that implements DerefMut<Target=[u8]> that encapsulates some borrowed state from Img. I tried adding lifetimes to express that I only want my mutable slice as long as I can have a mutable reference to Img, but I get
damnit I have to go to work now why must life be so cruel. Please infer the question I'm attempting to ask