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

net: add support for getting abstract namespace from socketaddr #6144

Merged
merged 3 commits into from
Nov 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions tokio/src/net/unix/socketaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ impl SocketAddr {
pub fn as_pathname(&self) -> Option<&Path> {
self.0.as_pathname()
}

/// Returns the contents of this address if it is an abstract namespace.
///
/// See also the standard library documentation on [`SocketAddr`].
///
/// [`SocketAddr`]: std::os::unix::net::SocketAddr
pub fn as_abstract_namespace(&self) -> Option<&[u8]> {
self.0.as_abstract_namespace()
}
}

impl fmt::Debug for SocketAddr {
Expand Down