Enum tokio_vsock::SockAddr
#[non_exhaustive]
pub enum SockAddr {
Inet(InetAddr),
Unix(UnixAddr),
Netlink(NetlinkAddr),
Alg(AlgAddr),
Link(LinkAddr),
Vsock(VsockAddr),
}
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.
Inet(InetAddr)
Unix(UnixAddr)
Netlink(NetlinkAddr)
Alg(AlgAddr)
Link(LinkAddr)
Datalink address (MAC)
Vsock(VsockAddr)
Implementations§
§impl SockAddr
impl SockAddr
pub fn new_inet(addr: InetAddr) -> SockAddr
pub fn new_unix<P>(path: &P) -> Result<SockAddr, Errno>where
P: NixPath + ?Sized,
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
pub fn as_ffi_pair(&self) -> (&sockaddr, u32)
pub fn as_ffi_pair(&self) -> (&sockaddr, u32)
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 StructuralEq for SockAddr
impl StructuralPartialEq for SockAddr
Auto Trait Implementations§
impl RefUnwindSafe for SockAddr
impl Send for SockAddr
impl Sync for SockAddr
impl Unpin for SockAddr
impl UnwindSafe for SockAddr
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request