]> git.bitcoin.ninja Git - ldk-c-bindings/commit
Add an export tag to indicate users cannot implement a given trait
authorMatt Corallo <git@bluematt.me>
Sun, 30 May 2021 16:17:25 +0000 (16:17 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 30 May 2021 16:59:51 +0000 (16:59 +0000)
commitabc2e0d8b1b385b820387da354bfe3694d433bb2
tree964695874342a80a9de1d80b8e0822d4e59f7d9c
parent42f443826a74246e49d8fbbd2590c061ca8308be
Add an export tag to indicate users cannot implement a given trait

Specifically, for the LDK `EventsProvider` trait, we can't
(trivially) implement the `process_pending_events` function,
defined as:
`fn process_pending_events<H: Deref>(&self, handler: H) where H::Target: EventHandler;`

We currently do not support implementing generic methods, as we'd
need to wrap them in a generic Rust-trait-to-C-trait conversion
utility, which we do not currently have. Thus, because users
almost certainly have no reason to implement the `EventsProvider`
themselves, its simpler to simply prevent the use of the C trait
struct as the Rust trait.

Concretely, this means just skipping the
`impl rustEventsProvider for CEventsProvider` block, which works
fine as no Rust functions take an `EventsProvider` as an argument.
c-bindings-gen/src/main.rs
c-bindings-gen/src/types.rs