diff options
| author | jD91mZM2 <me@krake.one> | 2018-07-07 06:52:03 +0200 |
|---|---|---|
| committer | jD91mZM2 <me@krake.one> | 2018-07-07 06:52:03 +0200 |
| commit | c007a78d23b684b8edaf624a93ec2d0579a37a86 (patch) | |
| tree | 61fa9d0f921a2694acfffcf1310cde1d127579a1 | |
| parent | abac5e722f3786fe2692bde9ab626afb25dd02de (diff) | |
| download | rust-c007a78d23b684b8edaf624a93ec2d0579a37a86.tar.gz rust-c007a78d23b684b8edaf624a93ec2d0579a37a86.zip | |
Add is_unnamed
| -rw-r--r-- | src/libstd/sys/redox/ext/net.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libstd/sys/redox/ext/net.rs b/src/libstd/sys/redox/ext/net.rs index d29d28c8427..4c5f8574621 100644 --- a/src/libstd/sys/redox/ext/net.rs +++ b/src/libstd/sys/redox/ext/net.rs @@ -67,6 +67,33 @@ impl SocketAddr { pub fn as_pathname(&self) -> Option<&Path> { None } + + /// Returns true if and only if the address is unnamed. + /// + /// # Examples + /// + /// A named address: + /// + /// ```no_run + /// use std::os::unix::net::UnixListener; + /// + /// let socket = UnixListener::bind("/tmp/sock").unwrap(); + /// let addr = socket.local_addr().expect("Couldn't get local address"); + /// assert_eq!(addr.is_unnamed(), false); + /// ``` + /// + /// An unnamed address: + /// + /// ``` + /// use std::os::unix::net::UnixDatagram; + /// + /// let socket = UnixDatagram::unbound().unwrap(); + /// let addr = socket.local_addr().expect("Couldn't get local address"); + /// assert_eq!(addr.is_unnamed(), true); + /// ``` + pub fn is_unnamed(&self) -> bool { + false + } } impl fmt::Debug for SocketAddr { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
