Update send_dgram function signature. (#91)

* Update send_dgram function signature.

All other fns take `&SocketAddr`.

* Fix tests
This commit is contained in:
Carl Lerche
2018-01-30 14:49:55 -06:00
committed by Alex Crichton
parent 117dcba8cb
commit 0f4706d752
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -184,10 +184,10 @@ impl UdpSocket {
/// The `buf` parameter here only requires the `AsRef<[u8]>` trait, which
/// should be broadly applicable to accepting data which can be converted
/// to a slice.
pub fn send_dgram<T>(self, buf: T, addr: SocketAddr) -> SendDgram<T>
pub fn send_dgram<T>(self, buf: T, addr: &SocketAddr) -> SendDgram<T>
where T: AsRef<[u8]>,
{
SendDgram::new(self, buf, addr)
SendDgram::new(self, buf, *addr)
}
/// Receives data from the socket. On success, returns the number of bytes
+2 -2
View File
@@ -170,7 +170,7 @@ fn send_dgrams() {
let b_addr = t!(b.local_addr());
{
let send = a.send_dgram(&b"4321"[..], b_addr);
let send = a.send_dgram(&b"4321"[..], &b_addr);
let recv = b.recv_dgram(&mut buf[..]);
let (sendt, received) = t!(send.join(recv).wait());
assert_eq!(received.2, 4);
@@ -180,7 +180,7 @@ fn send_dgrams() {
}
{
let send = a.send_dgram(&b""[..], b_addr);
let send = a.send_dgram(&b""[..], &b_addr);
let recv = b.recv_dgram(&mut buf[..]);
let received = t!(send.join(recv).wait()).1;
assert_eq!(received.2, 0);