Move trait bounds on `wire::Type` from use to the trait itself
authorMatt Corallo <git@bluematt.me>
Wed, 22 Sep 2021 01:04:35 +0000 (01:04 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 22 Sep 2021 01:07:30 +0000 (01:07 +0000)
commit4c813186dc9f27a70dc3fedad19d59a7230b88f3
treee674b9ea3e93c03df7ef2dc2a02dd1ed01d3e05e
parent34dd7c5cbbfe04a91edacfc995499a40f22e9d7c
Move trait bounds on `wire::Type` from use to the trait itself

`wire::Type` is only (publicly) used as the `CustomMessage`
associated type in `CustomMessageReader`, where it has additional
trait bounds on `Debug` and `Writeable`. The documentation for
`Type` even mentions that you need to implement `Writeable` because
this is the one place it is used.

To make this more clear, we move the type bounds onto the trait
itself and not on the associated type.

This is also the only practical way to build C bindings for `Type`
as we cannot have a concrete, single, `Type` struct in C which only
optionally implements various subtraits, at least not without
runtime checking of the type bounds.
lightning/src/ln/wire.rs