From 3753f52c43165a32eafc2192ce0d3057cd73d3e5 Mon Sep 17 00:00:00 2001 From: Hans Krutzer Date: Sun, 12 Nov 2023 13:58:00 +0100 Subject: [PATCH 1/2] net: support getting abstract namespace from socketaddr --- tokio/src/net/unix/socketaddr.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tokio/src/net/unix/socketaddr.rs b/tokio/src/net/unix/socketaddr.rs index 48f7b96b8c2..a6a04c02773 100644 --- a/tokio/src/net/unix/socketaddr.rs +++ b/tokio/src/net/unix/socketaddr.rs @@ -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. + /// + /// Documentation reflected in [`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 { From 6c1d36c39f9dfd5278589d94098393f4649b2c45 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sat, 25 Nov 2023 15:28:39 +0100 Subject: [PATCH 2/2] Update tokio/src/net/unix/socketaddr.rs --- tokio/src/net/unix/socketaddr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/net/unix/socketaddr.rs b/tokio/src/net/unix/socketaddr.rs index a6a04c02773..dbedc2d3295 100644 --- a/tokio/src/net/unix/socketaddr.rs +++ b/tokio/src/net/unix/socketaddr.rs @@ -25,7 +25,7 @@ impl SocketAddr { /// Returns the contents of this address if it is an abstract namespace. /// - /// Documentation reflected in [`SocketAddr`] + /// See also the standard library documentation on [`SocketAddr`]. /// /// [`SocketAddr`]: std::os::unix::net::SocketAddr pub fn as_abstract_namespace(&self) -> Option<&[u8]> {