Skip to content
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

Ideally get_interfaces() should return an Iterator #45

Open
brainplot opened this issue Oct 18, 2023 · 3 comments
Open

Ideally get_interfaces() should return an Iterator #45

brainplot opened this issue Oct 18, 2023 · 3 comments

Comments

@brainplot
Copy link
Contributor

Returning some iterator type instead of the whole Vec directly would allow consumers to have more control over how memory is allocated.

This, however, would be a pretty major breaking change in the public API. If you agree with this change, I can attempt writing a PR.

@shellrow
Copy link
Owner

Thank you for your proposal, and I appreciate your suggestion regarding memory optimization.
I agree with the proposed change.
As part of my roadmap, planning to make changes to the public API up to version 1.0.0, and this memory optimization fits into efforts to enhance the library's functionality and performance.

If you have any questions or further suggestions, please feel free to let me know.

@brainplot
Copy link
Contributor Author

Would you consider PRs or would you rather work on this yourself?

@shellrow
Copy link
Owner

Please feel free to proceed with the PR, and I'll actively review and collaborate on the changes.

RReverser added a commit to RReverser/netdev that referenced this issue Aug 27, 2024
 - Fewer deps for Windows (doesn't need libc and memalloc anymore).
 - Somewhat safer allocation - relying on Vec + Drop which is guaranteed to run on any panic / return / etc instead of manually tracking a raw pointer for the buffer.
 - Increase initial buffer size as per official recommendations.
 - Add safe iteration helper for Windows linked lists (assuming that, if the first pointer is valid, then all others should be as well and will have the same lifetime). This significantly reduces number of individual `unsafe` usages and paves path for shellrow#45 as the entire function is now just an iterator + `.collect()`.
 - Simplify socket address conversions by relying on Rust's built-in endianness helpers and the SOCKADDR_INET helper union.
RReverser added a commit to RReverser/netdev that referenced this issue Aug 27, 2024
 - Fewer deps for Windows (doesn't need libc and memalloc anymore).
 - Somewhat safer allocation - relying on Vec + Drop which is guaranteed to run on any panic / return / etc instead of manually tracking a raw pointer for the buffer.
 - Increase initial buffer size as per official recommendations.
 - Add safe iteration helper for Windows linked lists (assuming that, if the first pointer is valid, then all others should be as well and will have the same lifetime). This significantly reduces number of individual `unsafe` usages and paves path for shellrow#45 as the entire function is now just an iterator + `.collect()`.
 - Simplify socket address conversions by relying on Rust's built-in endianness helpers and the SOCKADDR_INET helper union.
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

No branches or pull requests

2 participants