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
sourceimpl 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
sourceimpl Clone for SocketAddr
impl Clone for SocketAddr
sourcefn clone(&self) -> SocketAddr
fn clone(&self) -> SocketAddr
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SocketAddr
impl Debug for SocketAddr
sourceimpl PartialEq<SocketAddr> for SocketAddr
impl PartialEq<SocketAddr> for SocketAddr
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more