/// Receives a packet from this socket.

Receives a packet from this socket.
Receives a packet from this socket .
fn receive_packet<'a>(&mut self, buffer: &'a mut [u8]) -> Result<(&'a [u8], SocketAddr)> {
        if let Some((addr, payload)) = self
            .network
            .borrow_mut()
            .get_mut(&self.address)
            .unwrap()
            .pop_front()
        {
            let slice = &mut buffer[..payload.len()];
            slice.copy_from_slice(payload.as_ref());
            Ok((slice, addr))
        } else {
            Err(std::io::ErrorKind::WouldBlock.into())
        }
    }
fn receive_packet < ' a > ( & mut self , buffer : & ' a mut [ u8 ] ) -> Result < ( & ' a [ u8 ] , SocketAddr ) > { if let Some ( ( addr , payload ) ) = self . network . borrow_mut ( ) . get_mut ( & self . address ) . unwrap ( ) . pop_front ( ) { let slice = & mut buffer [ .. payload . len ( ) ] ; slice . copy_from_slice ( payload . as_ref ( ) ) ; Ok ( ( slice , addr ) ) } else { Err ( std :: io :: ErrorKind :: WouldBlock . into ( ) ) } }
Receives a packet from this socket.
Receives a packet from this socket .
&mut self
buffer
&'a mut [u8]