Struct uds_windows::SocketAddr
source · pub struct SocketAddr { /* private fields */ }
Expand description
An address associated with a Unix socket
Examples
use uds_windows::UnixListener;
let l = UnixListener::bind("/tmp/sock").unwrap();
let addr = l.local_addr().expect("Couldn't get local address");
Implementations§
source§impl SocketAddr
impl SocketAddr
sourcepub fn is_unnamed(&self) -> bool
pub fn is_unnamed(&self) -> bool
Returns true if and only if the address is unnamed.
Examples
A named address:
use uds_windows::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);
sourcepub fn as_pathname(&self) -> Option<&Path>
pub fn as_pathname(&self) -> Option<&Path>
Returns the contents of this address if it is a pathname
address.
Examples
With a pathname:
use uds_windows::UnixListener;
use std::path::Path;
let socket = UnixListener::bind("/tmp/sock").unwrap();
let addr = socket.local_addr().expect("Couldn't get local address");
assert_eq!(addr.as_pathname(), Some(Path::new("/tmp/sock")));
Trait Implementations§
source§impl Clone for SocketAddr
impl Clone for SocketAddr
source§fn clone(&self) -> SocketAddr
fn clone(&self) -> SocketAddr
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more