Skip to content

Conversation

@lucab
Copy link
Contributor

@lucab lucab commented Jul 28, 2025

This adds a Linux-specific SocketAddr::as_abstract_name() based on stdlib SocketAddrExt trait (available since Rust 1.70).
The current MSRV is already 1.70.0, so this is not a breaking change.

Closes: #6202

@lucab lucab force-pushed the lucab/net-unix-abstract branch 3 times, most recently from 864419d to ac04acf Compare July 28, 2025 13:32
@lucab lucab marked this pull request as ready for review July 28, 2025 14:29
@lucab
Copy link
Contributor Author

lucab commented Jul 28, 2025

CI green and up for review.
/cc @Darksonn @ADD-SP

@ADD-SP ADD-SP added C-enhancement Category: A PR with an enhancement or bugfix. A-tokio Area: The main tokio crate M-net Module: tokio/net labels Jul 29, 2025
@ADD-SP ADD-SP changed the title unix/socketaddr: add as_abstract_name net: add unix::SocketAddr::as_abstract_name Jul 29, 2025
Copy link
Member

@ADD-SP ADD-SP left a comment

Choose a reason for hiding this comment

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

I have renamed the title to:

net: add unix::SocketAddr::as_abstract_name

@ADD-SP
Copy link
Member

ADD-SP commented Jul 29, 2025

Since the current MSRV is 1.70.0, and the SocketAddrExt is available since 1.70.0, this is not a breaking change.

Copy link
Member

@ADD-SP ADD-SP left a comment

Choose a reason for hiding this comment

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

Looks good to me, could you take a look @Darksonn as you are the issue author and may have more context?

@ADD-SP ADD-SP requested a review from Darksonn July 29, 2025 01:45
This adds a Linux-specific `SocketAddr::as_abstract_name()` based on
stdlib `SocketAddrExt` trait (available since Rust 1.70).
The current MSRV is already 1.70.0, so this is not a breaking change.
@lucab lucab force-pushed the lucab/net-unix-abstract branch from ac04acf to 54a40d3 Compare July 29, 2025 07:24
Copy link
Contributor Author

@lucab lucab left a comment

Choose a reason for hiding this comment

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

(Sorry I forgot to submit this review draft yesterday)

#[cfg(any(target_os = "linux", target_os = "android"))]
#[cfg_attr(docsrs, doc(cfg(any(target_os = "linux", target_os = "android"))))]
pub fn as_abstract_name(&self) -> Option<&[u8]> {
use std::os::linux::net::SocketAddrExt;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this trait has been added in Rust 1.70, which is compatible with current MSRV:

rust-version = "1.70"

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thank you.

@Darksonn Darksonn merged commit 1b27e17 into tokio-rs:master Jul 29, 2025
86 checks passed
@lucab lucab deleted the lucab/net-unix-abstract branch July 29, 2025 15:17
@Darksonn Darksonn mentioned this pull request Oct 14, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SocketAddr::as_abstract_namespace when we switch to mio v1

3 participants