MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / with_sockaddr

Method with_sockaddr

src/net/addr.rs:120–128  ·  view source on GitHub ↗
(
        &self,
        f: impl FnOnce(*const SocketAddrOpaque, SocketAddrLen) -> R,
    )

Source from the content-addressed store, hash-verified

118// SAFETY: This just forwards to the inner `SocketAddrArg` implementations.
119unsafe impl SocketAddrArg for SocketAddr {
120 unsafe fn with_sockaddr<R>(
121 &self,
122 f: impl FnOnce(*const SocketAddrOpaque, SocketAddrLen) -> R,
123 ) -> R {
124 match self {
125 Self::V4(v4) => v4.with_sockaddr(f),
126 Self::V6(v6) => v6.with_sockaddr(f),
127 }
128 }
129}
130
131// SAFETY: `with_sockaddr` calls `f` using `call_with_sockaddr`, which handles

Callers 9

sendtoFunction · 0.45
bindFunction · 0.45
connectFunction · 0.45
with_msghdrFunction · 0.45
sendtoFunction · 0.45
bindFunction · 0.45
connectFunction · 0.45
with_msghdrFunction · 0.45
write_sockaddrMethod · 0.45

Calls 6

call_with_sockaddrFunction · 0.85
fFunction · 0.85
as_ptrFunction · 0.85
encode_sockaddr_v4Function · 0.50
encode_sockaddr_v6Function · 0.50
addr_lenMethod · 0.45

Tested by

no test coverage detected