Skip to content

Commit

Permalink
Document Error::Finished in recv().
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio authored and whitequark committed Jun 12, 2020
1 parent 8d96626 commit 82a1c97
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/socket/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,13 @@ impl<'a> TcpSocket<'a> {
/// Call `f` with the largest contiguous slice of octets in the receive buffer,
/// and dequeue the amount of elements returned by `f`.
///
/// This function returns `Err(Error::Illegal)` if the receive half of
/// the connection is not open; see [may_recv](#method.may_recv).
/// This function errors if the receive half of the connection is not open.
///
/// If the receive half has been gracefully closed (with a FIN packet), `Err(Error::Finished)`
/// is returned. In this case, the previously received data is guaranteed to be complete.
///
/// In all other cases, `Err(Error::Illegal)` is returned and previously received data (if any)
/// may be incomplete (truncated).
pub fn recv<'b, F, R>(&'b mut self, f: F) -> Result<R>
where F: FnOnce(&'b mut [u8]) -> (usize, R) {
self.recv_impl(|rx_buffer| {
Expand Down

0 comments on commit 82a1c97

Please sign in to comment.