Add a macro which implements Readable/Writeable using TLVs only
authorMatt Corallo <git@bluematt.me>
Tue, 25 May 2021 21:18:30 +0000 (21:18 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 27 May 2021 21:41:07 +0000 (21:41 +0000)
commitcf430029c48940e9bf428d1336072573f8397368
tree4fa5b16cdf7a658ce917111357925e0f762b9be3
parentc9f6a35756b8418ed6fbeb48bc23cc19b42a9134
Add a macro which implements Readable/Writeable using TLVs only

This also includes a `VecWriteWrapper` and `VecReadWrapper` which
implements serialization for any `Readable`/`Writeable` type that is
in a Vec. We do this instead of implementing `Readable`/`Writeable`
directly as there isn't always a univerally-defined way to serialize
a Vec and this makes things more explicit.

Finally, this tweaks existing macros (and in the new macros) to
support a trailing `,` after a list, eg
`write_tlv_fields!(stream, {(0, a),}, {});` whereas previously the
trailing `,` after the `(0, a)` would be a compile-error.
lightning/src/util/ser.rs
lightning/src/util/ser_macros.rs