Skip to content

Commit 013792a

Browse files
committed
Use impl SocketAddress
1 parent 17b00ea commit 013792a

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

src/backend/libc/net/msghdr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ pub(crate) fn with_noaddr_msghdr<R>(
6161
}
6262

6363
/// Create a message header intended to send with the specified address.
64-
pub(crate) fn with_msghdr<R, A: SocketAddress>(
65-
addr: &A,
64+
pub(crate) fn with_msghdr<R>(
65+
addr: &impl SocketAddress,
6666
iov: &[IoSlice<'_>],
6767
control: &mut SendAncillaryBuffer<'_, '_, '_>,
6868
f: impl FnOnce(c::msghdr) -> R,

src/backend/libc/net/syscalls.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ pub(crate) unsafe fn recvfrom(
8686
}
8787

8888
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
89-
pub(crate) fn sendto<A: SocketAddress>(
89+
pub(crate) fn sendto(
9090
fd: BorrowedFd<'_>,
9191
buf: &[u8],
9292
flags: SendFlags,
93-
addr: &A,
93+
addr: &impl SocketAddress,
9494
) -> io::Result<usize> {
9595
unsafe {
9696
addr.with_sockaddr(|addr_ptr, addr_len| {
@@ -146,7 +146,7 @@ pub(crate) fn socket_with(
146146
}
147147

148148
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
149-
pub(crate) fn bind<A: SocketAddress>(sockfd: BorrowedFd<'_>, addr: &A) -> io::Result<()> {
149+
pub(crate) fn bind(sockfd: BorrowedFd<'_>, addr: &impl SocketAddress) -> io::Result<()> {
150150
unsafe {
151151
addr.with_sockaddr(|addr_ptr, addr_len| {
152152
ret(c::bind(borrowed_fd(sockfd), addr_ptr, addr_len))
@@ -155,7 +155,7 @@ pub(crate) fn bind<A: SocketAddress>(sockfd: BorrowedFd<'_>, addr: &A) -> io::Re
155155
}
156156

157157
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
158-
pub(crate) fn connect<A: SocketAddress>(sockfd: BorrowedFd<'_>, addr: &A) -> io::Result<()> {
158+
pub(crate) fn connect(sockfd: BorrowedFd<'_>, addr: &impl SocketAddress) -> io::Result<()> {
159159
unsafe {
160160
addr.with_sockaddr(|addr_ptr, addr_len| {
161161
ret(c::connect(borrowed_fd(sockfd), addr_ptr, addr_len))
@@ -256,9 +256,9 @@ pub(crate) fn sendmsg(
256256
target_os = "vita",
257257
target_os = "wasi"
258258
)))]
259-
pub(crate) fn sendmsg_addr<A: SocketAddress>(
259+
pub(crate) fn sendmsg_addr(
260260
sockfd: BorrowedFd<'_>,
261-
addr: &A,
261+
addr: &impl SocketAddress,
262262
iov: &[IoSlice<'_>],
263263
control: &mut SendAncillaryBuffer<'_, '_, '_>,
264264
msg_flags: SendFlags,

src/backend/linux_raw/net/msghdr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ pub(crate) fn with_noaddr_msghdr<R>(
7373
}
7474

7575
/// Create a message header intended to send with the specified address
76-
pub(crate) fn with_msghdr<R, A: SocketAddress>(
77-
addr: &A,
76+
pub(crate) fn with_msghdr<R>(
77+
addr: &impl SocketAddress,
7878
iov: &[IoSlice<'_>],
7979
control: &mut SendAncillaryBuffer<'_, '_, '_>,
8080
f: impl FnOnce(c::msghdr) -> R,

src/backend/linux_raw/net/syscalls.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ pub(crate) fn sendmsg(
311311
}
312312

313313
#[inline]
314-
pub(crate) fn sendmsg_addr<A: SocketAddress>(
314+
pub(crate) fn sendmsg_addr(
315315
sockfd: BorrowedFd<'_>,
316-
addr: &A,
316+
addr: &impl SocketAddress,
317317
iov: &[IoSlice<'_>],
318318
control: &mut SendAncillaryBuffer<'_, '_, '_>,
319319
msg_flags: SendFlags,
@@ -409,11 +409,11 @@ pub(crate) fn send(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags) -> io::Resu
409409
}
410410

411411
#[inline]
412-
pub(crate) fn sendto<A: SocketAddress>(
412+
pub(crate) fn sendto(
413413
fd: BorrowedFd<'_>,
414414
buf: &[u8],
415415
flags: SendFlags,
416-
addr: &A,
416+
addr: &impl SocketAddress,
417417
) -> io::Result<usize> {
418418
let (buf_addr, buf_len) = slice(buf);
419419

@@ -619,7 +619,7 @@ pub(crate) fn getsockname(fd: BorrowedFd<'_>) -> io::Result<SocketAddrAny> {
619619
}
620620

621621
#[inline]
622-
pub(crate) fn bind<A: SocketAddress>(fd: BorrowedFd<'_>, addr: &A) -> io::Result<()> {
622+
pub(crate) fn bind(fd: BorrowedFd<'_>, addr: &impl SocketAddress) -> io::Result<()> {
623623
addr.with_sockaddr(|addr_ptr, addr_len| {
624624
#[cfg(not(target_arch = "x86"))]
625625
unsafe {
@@ -646,7 +646,7 @@ pub(crate) fn bind<A: SocketAddress>(fd: BorrowedFd<'_>, addr: &A) -> io::Result
646646
}
647647

648648
#[inline]
649-
pub(crate) fn connect<A: SocketAddress>(fd: BorrowedFd<'_>, addr: &A) -> io::Result<()> {
649+
pub(crate) fn connect(fd: BorrowedFd<'_>, addr: &impl SocketAddress) -> io::Result<()> {
650650
addr.with_sockaddr(|addr_ptr, addr_len| {
651651
#[cfg(not(target_arch = "x86"))]
652652
unsafe {

src/net/send_recv/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ pub fn recvfrom_uninit<Fd: AsFd>(
197197
/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto&section=2
198198
/// [illumos]: https://illumos.org/man/3SOCKET/sendto
199199
/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html
200-
pub fn sendto<Fd: AsFd, A: SocketAddress>(
200+
pub fn sendto<Fd: AsFd>(
201201
fd: Fd,
202202
buf: &[u8],
203203
flags: SendFlags,
204-
addr: &A,
204+
addr: &impl SocketAddress,
205205
) -> io::Result<usize> {
206206
backend::net::syscalls::sendto(fd.as_fd(), buf, flags, addr)
207207
}

src/net/send_recv/msg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,9 @@ pub fn sendmsg(
641641
/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendmsg&section=2
642642
/// [illumos]: https://illumos.org/man/3SOCKET/sendmsg
643643
#[inline]
644-
pub fn sendmsg_addr<A: SocketAddress>(
644+
pub fn sendmsg_addr(
645645
socket: impl AsFd,
646-
addr: &A,
646+
addr: &impl SocketAddress,
647647
iov: &[IoSlice<'_>],
648648
control: &mut SendAncillaryBuffer<'_, '_, '_>,
649649
flags: SendFlags,

src/net/socket.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pub fn socket_with(
124124
/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind&section=2
125125
/// [illumos]: https://illumos.org/man/3SOCKET/bind
126126
/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html
127-
pub fn bind<Fd: AsFd, A: SocketAddress>(sockfd: Fd, addr: &A) -> io::Result<()> {
127+
pub fn bind<Fd: AsFd>(sockfd: Fd, addr: &impl SocketAddress) -> io::Result<()> {
128128
backend::net::syscalls::bind(sockfd.as_fd(), addr)
129129
}
130130

@@ -303,7 +303,7 @@ pub fn bind_xdp<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrXdp) -> io::Result<()> {
303303
/// [illumos]: https://illumos.org/man/3SOCKET/connect
304304
/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html
305305
/// [`Errno::WOULDBLOCK`]: io::Errno::WOULDBLOCK
306-
pub fn connect<Fd: AsFd, A: SocketAddress>(sockfd: Fd, addr: &A) -> io::Result<()> {
306+
pub fn connect<Fd: AsFd>(sockfd: Fd, addr: &impl SocketAddress) -> io::Result<()> {
307307
backend::net::syscalls::connect(sockfd.as_fd(), addr)
308308
}
309309

0 commit comments

Comments
 (0)