Skip to content

Add a bindings-only version of Future::register_callback #1737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2022

Conversation

TheBlueMatt
Copy link
Collaborator

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.

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-commenter
Copy link

codecov-commenter commented Sep 23, 2022

Codecov Report

Base: 90.70% // Head: 90.72% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (1beb3bb) compared to base (3b7859f).
Patch has no changes to coverable lines.

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     
Impacted Files Coverage Δ
lightning/src/util/wakers.rs 86.70% <ø> (ø)
lightning/src/ln/channelmanager.rs 85.09% <0.00%> (-0.03%) ⬇️
lightning/src/ln/monitor_tests.rs 99.55% <0.00%> (+0.11%) ⬆️
lightning/src/ln/functional_tests.rs 97.05% <0.00%> (+0.14%) ⬆️

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

/// 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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@TheBlueMatt TheBlueMatt merged commit 969574c into lightningdevkit:main Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants