Add a bindings-only version of Future::register_callback#1737
Merged
TheBlueMatt merged 1 commit intolightningdevkit:mainfrom Sep 25, 2022
Merged
Add a bindings-only version of Future::register_callback#1737TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
Future::register_callback#1737TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
Conversation
While we could, in theory, add support to the bindings logic to map `Box<dyn Trait>`, there isn't a whole lot of use doing so when its incredibly trivial to do directly. This adds a trivial wrapper around `Future::register_callback` that is only built in bindings and which is linked in the `register_callback` docs for visibility.
Codecov ReportBase: 90.70% // Head: 90.72% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1737 +/- ##
==========================================
+ Coverage 90.70% 90.72% +0.02%
==========================================
Files 87 87
Lines 46688 46688
Branches 46688 46688
==========================================
+ Hits 42349 42359 +10
+ Misses 4339 4329 -10
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
dunxen
approved these changes
Sep 24, 2022
| /// Registers a callback to be called upon completion of this future. If the future has already | ||
| /// completed, the callback will be called immediately. | ||
| #[cfg(c_bindings)] | ||
| pub fn register_callback_fn<F: 'static + FutureCallback>(&self, callback: F) { |
Contributor
There was a problem hiding this comment.
Looks good. I can't think of a better name, to be honest. It is a shame to have the discrepancy in naming between bindings/using Rust directly though, but this change is pretty simple and so probably best for now.
valentinewallace
approved these changes
Sep 24, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While we could, in theory, add support to the bindings logic to map
Box<dyn Trait>, there isn't a whole lot of use doing so when its incredibly trivial to do directly.This adds a trivial wrapper around
Future::register_callbackthat is only built in bindings and which is linked in theregister_callbackdocs for visibility.