[bindings] Convert manual `_read` implementations to return Results
authorMatt Corallo <git@bluematt.me>
Wed, 30 Dec 2020 22:30:59 +0000 (17:30 -0500)
committerMatt Corallo <git@bluematt.me>
Wed, 3 Feb 2021 03:51:52 +0000 (22:51 -0500)
commite36b51400fad4173cde525e0378e32e2bbcaa377
treeef5a70dd22f6bef6695a199b04d916ea47663fe7
parent0a6c9e85ff86f4b3e814a8286c3c311ade4e0c4a
[bindings] Convert manual `_read` implementations to return Results

Previously, manual `*_read` implementations were only defined for
types with inner fields, which were set to NULL to indicate read
errors. This prevents exposing `*_read` for several other types,
including tuples (which are needed for `ChannelManager`/
`ChannelMonitors`) and enums (which includes `Event`s, though users
likely never need to call that directly). Further, this means we
don't expose the actual error enum (which is likely no big deal,
but is still nice).

Here, we instead create the `Result<Object, DecodeError>` type and
then pass it through the normal type conversion functions, giving
us access to any types which we can convert normally.
c-bindings-gen/src/main.rs