Skip to content

Return slices, rather than Vec references, in addresses #3241

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

Conversation

TheBlueMatt
Copy link
Collaborator

Its a bit strange to return a reference to a Vec in Rust, when a slice is really intended as the way to do so. Worse, the bindings don't know how to map a reference to a Vec (but do have code to map a slice of Cloneable objects).

Here, we move NodeAnnouncementInfo::addresses to return a slice, though to do so we have to adapt the WithoutLength Writeable impl to support slices as well.

@TheBlueMatt TheBlueMatt added this to the 0.0.124 milestone Aug 14, 2024
Its a bit strange to return a reference to a `Vec` in Rust, when a
slice is really intended as the way to do so. Worse, the bindings
don't know how to map a reference to a `Vec` (but do have code to
map a slice of `Clone`able objects).

Here, we move `NodeAnnouncementInfo::addresses` to return a slice,
though to do so we have to adapt the `WithoutLength` `Writeable`
impl to support slices as well.
@TheBlueMatt TheBlueMatt force-pushed the 2024-08-ret-slice-not-ref-vec branch from ffc88b0 to b3aed9a Compare August 14, 2024 19:44
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 89.73%. Comparing base (33e6995) to head (b3aed9a).
Report is 2 commits behind head on main.

Files Patch % Lines
lightning-rapid-gossip-sync/src/processing.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3241      +/-   ##
==========================================
- Coverage   89.78%   89.73%   -0.06%     
==========================================
  Files         123      123              
  Lines      102330   102332       +2     
  Branches   102330   102332       +2     
==========================================
- Hits        91876    91825      -51     
- Misses       7763     7816      +53     
  Partials     2691     2691              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@optout21 optout21 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

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

Trivial enough so going to land this

@valentinewallace valentinewallace merged commit 137cfea into lightningdevkit:main Aug 15, 2024
18 of 21 checks passed
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.

3 participants