make SocketAddr copy rather than pass by ref

This commit is contained in:
Benjamin Fry
2020-11-16 10:15:18 -08:00
parent ec1513c59a
commit a1c4cdc962
4 changed files with 13 additions and 13 deletions

View File

@@ -25,7 +25,7 @@ pub struct AsyncStdUdpSocket(async_std::net::UdpSocket);
impl UdpSocket for AsyncStdUdpSocket {
type Time = AsyncStdTime;
async fn bind(addr: &SocketAddr) -> io::Result<Self> {
async fn bind(addr: SocketAddr) -> io::Result<Self> {
async_std::net::UdpSocket::bind(addr)
.await
.map(AsyncStdUdpSocket)
@@ -50,7 +50,7 @@ impl UdpSocket for AsyncStdUdpSocket {
&self,
cx: &mut Context,
buf: &[u8],
target: &SocketAddr,
target: SocketAddr,
) -> Poll<io::Result<usize>> {
let fut = self.0.send_to(buf, target);
pin_mut!(fut);
@@ -58,7 +58,7 @@ impl UdpSocket for AsyncStdUdpSocket {
fut.poll_unpin(cx)
}
async fn send_to(&self, buf: &[u8], target: &SocketAddr) -> io::Result<usize> {
async fn send_to(&self, buf: &[u8], target: SocketAddr) -> io::Result<usize> {
self.0.send_to(buf, target).await
}
}