Skip to content

Commit

Permalink
net: add SocketAddr::as_abstract_namespace (#6144)
Browse files Browse the repository at this point in the history
  • Loading branch information
hkrutzer committed Nov 25, 2023
1 parent a8e8fa6 commit 2400769
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tokio/src/net/unix/socketaddr.rs
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

0 comments on commit 2400769

Please sign in to comment.