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

Add direct conversion from SockAddrIn(6) to SocketAddr #2474

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

pronebird
Copy link
Contributor

What does this PR do

At the moment nix only offers conversions between SockaddrIn -> SocketAddrV4 and SockaddrIn6 -> SocketAddrV6 but no conversions to the container type, SocketAddr itself.

While it's trivial to wrap either SocketAddrV4 or SocketAddrV6 into SocketAddr, I think having a shortcut would improve ergonomics and essentially align nix with std, which supports From conversions from SocketAddrV{4,6} to SocketAddr.

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@SteveLauC SteveLauC added this pull request to the merge queue Aug 23, 2024
Merged via the queue into nix-rust:master with commit 43b7a74 Aug 23, 2024
36 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.

2 participants