]> git.bitcoin.ninja Git - rust-lightning/commit
[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>
Mon, 4 Jan 2021 21:14:26 +0000 (16:14 -0500)
commit886fbfc5e84aadf028c8b620dece3fb5a7127973
tree95f45160dc8d60efa18e3d0f188b5e018683cc45
parentd18a38064aeba70bfde716e907628024c266ba75
[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