#[non_exhaustive]pub enum SockAddr {
Unix(UnixAddr),
Netlink(NetlinkAddr),
Alg(AlgAddr),
Vsock(VsockAddr),
}
👎Deprecated since 0.24.0: use SockaddrLike or SockaddrStorage instead
Expand description
Represents a socket address
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Unix(UnixAddr)
👎Deprecated since 0.24.0: use SockaddrLike or SockaddrStorage instead
Netlink(NetlinkAddr)
👎Deprecated since 0.24.0: use SockaddrLike or SockaddrStorage instead
Alg(AlgAddr)
👎Deprecated since 0.24.0: use SockaddrLike or SockaddrStorage instead
Vsock(VsockAddr)
👎Deprecated since 0.24.0: use SockaddrLike or SockaddrStorage instead
Implementations§
source§impl SockAddr
impl SockAddr
pub fn new_unix<P: ?Sized + NixPath>(path: &P) -> Result<SockAddr>
pub fn new_netlink(pid: u32, groups: u32) -> SockAddr
pub fn new_alg(alg_type: &str, alg_name: &str) -> SockAddr
pub fn new_vsock(cid: u32, port: u32) -> SockAddr
pub fn family(&self) -> AddressFamily
pub fn to_str(&self) -> String
👎Deprecated since 0.23.0: use .to_string() instead
sourcepub fn as_ffi_pair(&self) -> (&sockaddr, socklen_t)
pub fn as_ffi_pair(&self) -> (&sockaddr, socklen_t)
Conversion from nix’s SockAddr type to the underlying libc sockaddr type.
This is useful for interfacing with other libc functions that don’t yet have nix wrappers. Returns a reference to the underlying data type (as a sockaddr reference) along with the size of the actual data type. sockaddr is commonly used as a proxy for a superclass as C doesn’t support inheritance, so many functions that take a sockaddr * need to take the size of the underlying type as well and then internally cast it back.
Trait Implementations§
impl Copy for SockAddr
impl Eq for SockAddr
impl StructuralPartialEq for SockAddr
Auto Trait Implementations§
impl Freeze for SockAddr
impl RefUnwindSafe for SockAddr
impl Send for SockAddr
impl Sync for SockAddr
impl Unpin for SockAddr
impl UnwindSafe for SockAddr
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)