Skip to content

Commit 2400769

Browse files
authored
net: add SocketAddr::as_abstract_namespace (#6144)
1 parent a8e8fa6 commit 2400769

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tokio/src/net/unix/socketaddr.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ impl SocketAddr {
2222
pub fn as_pathname(&self) -> Option<&Path> {
2323
self.0.as_pathname()
2424
}
25+
26+
/// Returns the contents of this address if it is an abstract namespace.
27+
///
28+
/// See also the standard library documentation on [`SocketAddr`].
29+
///
30+
/// [`SocketAddr`]: std::os::unix::net::SocketAddr
31+
pub fn as_abstract_namespace(&self) -> Option<&[u8]> {
32+
self.0.as_abstract_namespace()
33+
}
2534
}
2635

2736
impl fmt::Debug for SocketAddr {

0 commit comments

Comments
 (0)