-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
impl Clone for net::unix::SocketAddr #7422
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
Darksonn
merged 1 commit into
tokio-rs:master
from
xumaple:xumaple/clone-unix-socketaddr
Jun 30, 2025
Merged
impl Clone for net::unix::SocketAddr #7422
Darksonn
merged 1 commit into
tokio-rs:master
from
xumaple:xumaple/clone-unix-socketaddr
Jun 30, 2025
Conversation
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
ADD-SP
approved these changes
Jun 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the std version impls the Clone, I think it makes sense to do the same thing for the tokio version.
hawkw
added a commit
that referenced
this pull request
Jul 1, 2025
# 1.46.0 (July 1st, 2025) ### Fixed - net: fixed `TcpStream::shutdown` incorrectly returning an error on macOS ([#7290]) ## Added - sync: `mpsc::OwnedPermit::{same_channel, same_channel_as_sender}` methods ([#7389]) - macros: `biased` option for `join!` and `try_join!`, similar to `select!` ([#7307]) - net: support for cygwin ([#7393]) - net: support `pope::OpenOptions::read_write` on Android ([#7426]) - net: add `Clone` implementation for `net::unix::SocketAddr` ([#7422]) ## Changed - runtime: eliminate unnecessary lfence while operating on `queue::Local<T>` ([#7340]) - task: disallow blocking in `LocalSet::{poll,drop}` ([#7372]) ## Unstable - runtime: add `TaskMeta::spawn_location` tracking where a task was spawned ([#7417]) - runtime: removed borrow from `LocalOptions` parameter to `runtime::Builder::build_local` ([#7346]) ## Documented - io: clarify behavior of seeking when `start_seek` is not used ([#7366]) - io: document cancellation safety of `AsyncWriteExt::flush` ([#7364]) - net: fix docs for `recv_buffer_size` method ([#7336]) - net: fix broken link of `RawFd` in `TcpSocket` docs ([#7416]) - net: update `AsRawFd` doc link to current Rust stdlib location ([#7429]) - readme: fix double period in reactor description (#7363) - runtime: add doc note that `on_*_task_poll` is unstable ([#7311]) - sync: update broadcast docs on allocation failure ([#7352]) - time: add a missing panic scenario of `time::advance` ([#7394]) [#7290]: #7290 [#7307]: #7307 [#7311]: #7311 [#7336]: #7336 [#7340]: #7340 [#7346]: #7346 [#7352]: #7352 [#7364]: #7364 [#7366]: #7366 [#7372]: #7372 [#7389]: #7389 [#7393]: #7393 [#7394]: #7394 [#7416]: #7416 [#7422]: #7422 [#7426]: #7426 [#7429]: #7429 [#7417]: #7417
hawkw
added a commit
that referenced
this pull request
Jul 1, 2025
# 1.46.0 (July 1st, 2025) ### Fixed - net: fixed `TcpStream::shutdown` incorrectly returning an error on macOS ([#7290]) ## Added - sync: `mpsc::OwnedPermit::{same_channel, same_channel_as_sender}` methods ([#7389]) - macros: `biased` option for `join!` and `try_join!`, similar to `select!` ([#7307]) - net: support for cygwin ([#7393]) - net: support `pope::OpenOptions::read_write` on Android ([#7426]) - net: add `Clone` implementation for `net::unix::SocketAddr` ([#7422]) ## Changed - runtime: eliminate unnecessary lfence while operating on `queue::Local<T>` ([#7340]) - task: disallow blocking in `LocalSet::{poll,drop}` ([#7372]) ## Unstable - runtime: add `TaskMeta::spawn_location` tracking where a task was spawned ([#7417]) - runtime: removed borrow from `LocalOptions` parameter to `runtime::Builder::build_local` ([#7346]) ## Documented - io: clarify behavior of seeking when `start_seek` is not used ([#7366]) - io: document cancellation safety of `AsyncWriteExt::flush` ([#7364]) - net: fix docs for `recv_buffer_size` method ([#7336]) - net: fix broken link of `RawFd` in `TcpSocket` docs ([#7416]) - net: update `AsRawFd` doc link to current Rust stdlib location ([#7429]) - readme: fix double period in reactor description (#7363) - runtime: add doc note that `on_*_task_poll` is unstable ([#7311]) - sync: update broadcast docs on allocation failure ([#7352]) - time: add a missing panic scenario of `time::advance` ([#7394]) [#7290]: #7290 [#7307]: #7307 [#7311]: #7311 [#7336]: #7336 [#7340]: #7340 [#7346]: #7346 [#7352]: #7352 [#7364]: #7364 [#7366]: #7366 [#7372]: #7372 [#7389]: #7389 [#7393]: #7393 [#7394]: #7394 [#7416]: #7416 [#7422]: #7422 [#7426]: #7426 [#7429]: #7429 [#7417]: #7417
Closed
ADD-SP
pushed a commit
to ADD-SP/tokio
that referenced
this pull request
Oct 14, 2025
(cherry picked from commit 69290a6)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-tokio
Area: The main tokio crate
C-enhancement
Category: A PR with an enhancement or bugfix.
M-net
Module: tokio/net
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.
Motivation
tokio::net::unix::SocketAddrwraps astd::os::unix::net::SocketAddr. The latter implementsClone, but the former does not. This can be a bit annoying for certain niche use cases, such as when we want to use thetokioversion in relation toaxum::extract::connect_info::Connected. More than that, it simply makes sense toimpl Clonehere if the wrapped inner is alreadyimpl Clone.Solution
added a
#[derive(Clone)].Closes #7421.