I want to play waves generated by the waver crate via the rodio crate. To generate waves, waver provides the WaveIterator struct. To play sound, rodio provides the OutputStreamHandle, which takes a Source. Source is a trait, which can be implemented, so my genius plan was to just take WaveIterator and let it implement Source.
But my plan was foiled, because I can't implement traits for structs from other classes. Not to worry, I found something called the newtype pattern, which wraps a struct, in my case WaveIterator in another struct, and I can implement Source for that.
But now the compiler complains, that my struct is not an iterator, because Source expects an iterator. I thought, maybe implementing Deref and DerefMut would solve that problem, but it didn't. Has it maybe something to do with the lifetime annotation of WaveIterator?
So what do I do now? I don't want to reimplement every trait from WaveIterator manually for my wrapper struct. Is there a way to "inherit" the traits from the wrapped struct? Or am I doing this completely wrong?