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 moresource§impl Debug for SocketAddr
impl Debug for SocketAddr
source§impl PartialEq for SocketAddr
impl PartialEq for SocketAddr
source§fn eq(&self, other: &SocketAddr) -> bool
fn eq(&self, other: &SocketAddr) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for SocketAddr
Auto Trait Implementations§
impl RefUnwindSafe for SocketAddr
impl Send for SocketAddr
impl Sync for SocketAddr
impl Unpin for SocketAddr
impl UnwindSafe for SocketAddr
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more