pub fn close(&self) {
        let (maybe_peer, has_unread) = {
            let mut inner = self.lock();
            let maybe_peer = inner.peer().map(Arc::clone);
            inner.shutdown_read();
            (maybe_peer, !inner.messages.is_empty())
        };
        if let Some(peer) = maybe_peer {
            let mut peer_inner = peer.lock();
            if has_unread {
                peer_inner.messages.mark_peer_closed_with_unread_data();
            }
            peer_inner.shutdown_write();
        }
        self.lock().state = SocketState::Closed;
    }
/// Close this socket.
///
/// Called by SocketFile when the file descriptor that is holding this
/// socket is closed.
///
/// Close differs from shutdown in two ways. First, close will call
/// mark_peer_closed_with_unread_data if this socket has unread data,
/// which changes how read() behaves on that socket. Second, close
/// transitions the internal state of this socket to Closed, which breaks
/// the reference cycle that exists in the connected state.
Close this socket.
Called by SocketFile when the file descriptor that is holding this
socket is closed.

Close differs from shutdown in two ways. First, close will call
mark_peer_closed_with_unread_data if this socket has unread data,
which changes how read() behaves on that socket. Second, close
transitions the internal state of this socket to Closed, which breaks
the reference cycle that exists in the connected state.
Close this socket . Called by SocketFile when the file descriptor that is holding this socket is closed . Close differs from shutdown in two ways . First close will call mark_peer_closed_with_unread_data if this socket has unread data which changes how read () behaves on that socket . Second close transitions the internal state of this socket to Closed which breaks the reference cycle that exists in the connected state .
pub fn close(&self) {
        let (maybe_peer, has_unread) = {
            let mut inner = self.lock();
            let maybe_peer = inner.peer().map(Arc::clone);
            inner.shutdown_read();
            (maybe_peer, !inner.messages.is_empty())
        };
        if let Some(peer) = maybe_peer {
            let mut peer_inner = peer.lock();
            if has_unread {
                peer_inner.messages.mark_peer_closed_with_unread_data();
            }
            peer_inner.shutdown_write();
        }
        self.lock().state = SocketState::Closed;
    }
pub fn close ( & self ) { let ( maybe_peer , has_unread ) = { let mut inner = self . lock ( ) ; let maybe_peer = inner . peer ( ) . map ( Arc :: clone ) ; inner . shutdown_read ( ) ; ( maybe_peer , ! inner . messages . is_empty ( ) ) } ; if let Some ( peer ) = maybe_peer { let mut peer_inner = peer . lock ( ) ; if has_unread { peer_inner . messages . mark_peer_closed_with_unread_data ( ) ; } peer_inner . shutdown_write ( ) ; } self . lock ( ) . state = SocketState :: Closed ; }
Close this socket.
Close this socket .
&self
&self