Add a `*Ref` struct for traits and `Deref` to it rather than `Self`
Because LDK often takes `Deref<Target=Trait>` as type parameters,
we'd implemented `Deref { type Target=Self; .. }` for the traits
defined in the bindings crate. This worked well, but because Rust
auto-`Deref`s, it can lead to spurious compilation failures due to
infinite recursion trying to deref.
In the past we've worked around this by coming up with alternative
compilation strategies when faced with `Deref` recursion, but we
don't strictly need to.
Instead, here, we introduce duplicates of all our `Trait` structs
which become the `Deref` `Target`. This way, we can `Deref` into
the `Trait` and maintain LDK compatibility, without having any
infinite `Deref` recursion issues.
One complication is traits which contain associated types to define
`Deref`s to another associated type, e.g.
trait A {
type B;
type C: Deref<Target = Self::B>;
}
In this case, `B` needs to be the `TraitRef` and `C` needs to be
the `Trait`. We add code specifically to detect this case.