Skip to content
This repository was archived by the owner on Jun 27, 2022. It is now read-only.

Commit e761a27

Browse files
committed
Add documentation.
1 parent 8d36fc4 commit e761a27

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

with_read_timeout/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ extern crate libc;
66
use std::io::Result;
77
use std::net::{UdpSocket, SocketAddr};
88

9+
/// A trait to make time-limited reads from socket-like objects.
910
pub trait WithReadTimeout {
11+
/// Receives data from the object, blocking for at most the specified number of milliseconds.
12+
/// On success, returns the number of bytes read and the address from whence the data came. If
13+
/// the timeout expires, it returns `ErrorKind::WouldBlock`.
1014
fn recv_timeout(&mut self, &mut [u8], i64) -> Result<(usize, SocketAddr)>;
1115
}
1216

@@ -25,6 +29,7 @@ impl WithReadTimeout for UdpSocket {
2529
}
2630

2731
#[cfg(windows)]
32+
/// TODO: Set timeout on socket
2833
fn recv_timeout(&mut self, buf: &mut [u8], _timeout: i64) -> Result<(usize, SocketAddr)> {
2934
self.recv_from(buf)
3035
}

0 commit comments

Comments
 (0)